成人午夜视频全免费观看高清-秋霞福利视频一区二区三区-国产精品久久久久电影小说-亚洲不卡区三一区三区一区

vb.net控件教程,vb網(wǎng)頁控件

vb.net怎么使用表格控件?

DataGridView控件,放一個DataGridView1和Button1到窗體,下面是按鈕下代碼

站在用戶的角度思考問題,與客戶深入溝通,找到郁南網(wǎng)站設(shè)計與郁南網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗,讓設(shè)計與互聯(lián)網(wǎng)技術(shù)結(jié)合,創(chuàng)造個性化、用戶體驗好的作品,建站類型包括:網(wǎng)站制作、網(wǎng)站建設(shè)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機端網(wǎng)站、網(wǎng)站推廣、域名注冊、雅安服務(wù)器托管、企業(yè)郵箱。業(yè)務(wù)覆蓋郁南地區(qū)。

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

Me.DataGridView1.AllowUserToAddRows = False

DataGridView1.RowTemplate.Height = 200

DataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None

For i = 1 To 3

Me.DataGridView1.Columns.Add("列" i.ToString, "列" i.ToString)

Me.DataGridView1.Rows.Add()

Next

Me.DataGridView1.Columns(0).Width = 100

Me.DataGridView1.Columns(1).Width = 500

Me.DataGridView1.Columns(0).Width = 300

End Sub

'自己設(shè)置相關(guān)需要的屬性即可

VB.net如何添加winsock控件和Ado控件

步驟如下:

1. 先到C:\WINDOWS\system32目錄下看看你的系統(tǒng)里是否已經(jīng)有了MSADODC.ocx和MSDATGRD.ocx這兩個文件(多半是沒有的),要是有了就直接看第2步吧。

然后放到C:\WINDOWS\system32目錄下。

2. 在VS 2005中注冊MSADODC.ocx和MSDATGRD.ocx這兩個控件。在VS 2005中點擊"Tools" -- "Visual Studio 2005 Command Prompt",輸入如下命令即可:

regsvr32 msadodc.ocx

regsvr32 msdatgrd.ocx

如何在vb.net里面動態(tài)添加控件

Private WithEvents NewTextBox As TextBox

'通過使用WithEvents關(guān)鍵字聲明一個對象變量為新的命令按鈕

Private Sub Command1_Click()

If NewTextBox Is Nothing Then

Set NewTextBox = Controls.Add("VB.TextBox", "cmdNew", Form1)

NewTextBox.Move 200, 200

NewTextBox.Width = Form1.Width - 450

NewTextBox.Height = Form1.Height - 1400

NewTextBox.Visible = True

End If

End Sub

Private Sub Command2_Click()

If NewTextBox Is Nothing Then

Exit Sub

Else

Controls.Remove NewTextBox

Set NewTextBox = Nothing

End If

End Sub

求VB.net datagrid 控件的使用方法(入門級)

Dim tab1 As String

Dim DS As New DataSet

Dim SqlStr As String

Dim DTS_A As New DataGridTableStyle

Dim Col_A1, Col_A2, Col_A3 As New DataGridTextBoxColumn

Dim Col_bo As New DataGridBoolColumn

'DS.Tables("tab1").Columns.Add("check", System.Type.GetType("System.Boolean"))

'DS.Tables("tab1").Columns("check").DefaultValue = False

Dim Col_A() As DataGridColumnStyle = {Col_bo, Col_A1, Col_A2, Col_A3}

'主窗口

Private Sub fICitem_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

ProgressBar1.Hide()

grdStyles("tab1")

SQLConn(conn)

Dim i As Integer

'Dim arr As New ArrayList

SqlStr = "SELECT ID, diqu, dname FROM a_diqu Order by ID"

If Not SQLFill(conn, DA, DS, SqlStr, "diqu") Then

MsgBox("服務(wù)器連接失敗")

Else

Dim dr As DataRow

For Each dr In DS.Tables("diqu").Rows

'arr.Add(dr("diqu") "." dr("dname"))

cmbDiqu.Items.Add(dr("diqu") "." dr("dname"))

Next

End If

'cmbDiqu.DataSource = arr

cmbDiqu.SelectedIndex = -1

cmbDiqu.Text = ""

End Sub

'DataGrid格式

Private Sub grdStyles(ByVal tab As String)

Dim ii1 As Integer

Dim DTS_A1() As String = {"check", "fshortnumber", "fnumber", "fplanprice"}

Dim DTS_A2() As String = {"檢查框", "貨號", "上市月份", "單價"}

Dim DTS_A3() As Integer = {50, 120, 120, 120} '長度

Dim DTS_A4() As Integer = {2, 0, 2, 1} '對齊方式

DTS_A.MappingName = tab

DTS_A.GridColumnStyles.Clear()

DTS_A.AllowSorting = True

DTS_A.ReadOnly = True

DTS_A.BackColor = Color.DarkGray

DTS_A.AlternatingBackColor = Color.LightGray

For ii1 = 0 To DTS_A1.Length - 1

Col_A(ii1).MappingName = DTS_A1(ii1)

Col_A(ii1).HeaderText = DTS_A2(ii1)

Col_A(ii1).Width = DTS_A3(ii1)

Col_A(ii1).NullText = ""

Col_A(ii1).Alignment = DTS_A4(ii1)

Next

DTS_A.GridColumnStyles.AddRange(Col_A)

grdItem.TableStyles.Add(DTS_A)

grdItem.ReadOnly = True

End Sub

Private Sub fICitem_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Closed

SQLClose(conn)

End Sub

'顯示表單

Private Sub Show1()

grdStyles("tab1")

txtNum.Text = Trim(txtNum.Text)

grdItem.DataSource = Nothing

SQLStr = "select * from t_icitem_new"

SQLStr = " where fshortnumber like '" txtNum.Text "%'"

SQLStr = " order by fshortnumber"

SQLFill(conn, DA, DS, SQLStr, tab1)

grdItem.CaptionText = "貨號資料"

grdItem.DataSource = DS.Tables(tab1)

ShowRow()

End Sub

'數(shù)據(jù)同步顯示

Private Sub ShowRow()

Dim dr As DataRow

If DS.Tables(tab1).Rows.Count 0 Then

If grdItem.CurrentRowIndex DS.Tables(tab1).Rows.Count Then

grdItem.CaptionText = grdItem.CurrentRowIndex + 1 "/" DS.Tables(tab1).Rows.Count

dr = DS.Tables(tab1).Rows(grdItem.CurrentRowIndex)

txtNum.Text = dr.Item("fshortnumber")

txtPrice.Text = dr.Item("fplanprice")

cmbMonth.Text = dr.Item("fnumber")

Else

txtNum.Text = ""

txtPrice.Text = ""

cmbMonth.Text = ""

End If

Else

txtNum.Text = ""

txtPrice.Text = ""

cmbMonth.Text = ""

End If

End Sub

Private Sub grdItem_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles grdItem.CurrentCellChanged

ShowRow()

End Sub

'鼠標(biāo)選定行

Private Sub grdItem_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles grdItem.CurrentCellChanged

ShowRow()

End Sub

Private Sub btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _

Handles btnSelect.Click, btnUpdate.Click, btnInsert.Click, btnDelete.Click

Select Case sender.name

Case "btnSelect" '查詢

Show1()

Case "btnUpdate" '修改

SUpdate()

Case "btnInsert" '新增

SInsert()

Case "btnDelete" '刪除

SDelete()

End Select

End Sub

'修改

Private Sub SUpdate()

txtNum.Text = Trim(txtNum.Text)

txtPrice.Text = Trim(txtPrice.Text)

If MsgBox("確定更新?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then

SQLStr = "UPDATE t_icitem_new SET "

SQLStr = "fnumber='" cmbMonth.SelectedItem "', "

SQLStr = "fplanprice='" txtPrice.Text "' "

SQLStr = "WHERE fshortnumber='" txtNum.Text "'"

If Not SQLFill2(conn, SQLStr) Then

MsgBox("抱歉,更新失敗:(")

End If

Show1()

End If

End Sub

'新增

Private Sub SInsert()

txtNum.Text = Trim(txtNum.Text)

txtPrice.Text = Trim(txtPrice.Text)

If MsgBox("確定新增?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then

SQLStr = "SELECT fshortnumber "

SQLStr = "FROM t_icitem_new "

SQLStr = "WHERE fshortnumber = '" txtNum.Text "' "

SQLFill(conn, DA, DS, SQLStr, "Tmp")

If DS.Tables("Tmp").Rows.Count = 0 Then '如果沒有資料則新增

SQLStr = "INSERT INTO t_icitem_new (fshortnumber,fnumber,fplanprice) VALUES("

SQLStr = "'" txtNum.Text "', "

SQLStr = "'" cmbMonth.SelectedItem "', "

SQLStr = "'" txtPrice.Text "')"

If Not SQLFill2(conn, SQLStr) Then

MsgBox("抱歉,新增失敗:(")

End If

Show1()

Else

MsgBox("資料已存在")

End If

End If

End Sub

'刪除

Private Sub SDelete()

txtNum.Text = Trim(txtNum.Text)

txtPrice.Text = Trim(txtPrice.Text)

If MsgBox("確定刪除" txtNum.Text "?", MsgBoxStyle.YesNo + MsgBoxStyle.DefaultButton2) = MsgBoxResult.Yes Then

SQLStr = "DELETE FROM t_icitem_new "

SQLStr = "WHERE fshortnumber='" txtNum.Text "'"

If Not SQLFill2(conn, SQLStr) Then

MsgBox("抱歉,刪除失敗:(")

End If

Show1()

End If

'鍵盤順序

Private Sub txt_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) _

Handles txtFshop.KeyDown, txtItem.KeyDown

Select Case e.KeyCode

Case Keys.Return

SendKeys.Send("{TAB}")

Case Keys.Right

SendKeys.Send("{TAB}")

Case Keys.Left

SendKeys.Send("+{TAB}")

Case Keys.Down

SendKeys.Send("{TAB 10}")

Case Keys.Up

SendKeys.Send("+{TAB 10}")

End Select

End Sub

你好,我想請教一下vb.net中怎么調(diào)用用戶控件,謝謝!

關(guān)于用戶控件的使用,.net與v6環(huán)境下是有那么小小的區(qū)別。v6環(huán)境下的用戶控件編寫后可以直接使用,而在.net環(huán)境下,則需要先生成控件庫(dll,應(yīng)用程序擴展格式),然后再將這個控件庫導(dǎo)入到.net編程環(huán)境的工具箱上方可使用。其具體方法如下(以VS 2010,Visual Basic.net 為例):1、新建項目-Visual Basic-Windows-Windows 窗體控件庫-鍵入控件庫名稱(默認(rèn)為Usercontrol1)確定;2、設(shè)計你的用戶控件,完成后按“F7”進(jìn)行編譯;3、在該解決方案目錄下找到控件庫擴展(默認(rèn)為UserControl1.dll),確認(rèn)項目已經(jīng)生成。在上三項為控件庫DLL的生成方式,下面是調(diào)用方式:4、新建項目-Visual Basic-Windows-Windows 窗體應(yīng)用程序-確定;5、打開工具箱,以任意一個控件上點擊右鍵-選擇項-.net framework組件-瀏覽-定位到生成的控件庫擴展-確定;6、在工具箱中找到新添加的用戶控件,將其拖至窗體中進(jìn)行設(shè)計。經(jīng)測,在.net環(huán)境下編譯的用戶控件是通用的。也就是說使用Visual Basic.net編寫的用戶控件,也可以在C#工程里使用,反之亦然。這充分體現(xiàn)了.net語言的交互性,在我看來,.net下各種語言能力相當(dāng),它們都是作為一種中間語言,編譯出中間代碼。所以,在.net環(huán)境下,采用混合編程也未嘗不是一樣提高效率的一種可選的方式。

當(dāng)前名稱:vb.net控件教程,vb網(wǎng)頁控件
文章路徑:http://jinyejixie.com/article44/dsecihe.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)頁設(shè)計公司、做網(wǎng)站電子商務(wù)、ChatGPT、手機網(wǎng)站建設(shè)、

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)頁設(shè)計公司
禹州市| 米脂县| 大石桥市| 朔州市| 西乌珠穆沁旗| 赤水市| 临颍县| 黄山市| 泰来县| 海兴县| 普兰县| 利辛县| 隆尧县| 黔西县| 陵川县| 洪雅县| 同江市| 蒙自县| 进贤县| 西乌| 清流县| 德江县| 陵水| 休宁县| 高州市| 水城县| 都匀市| 长顺县| 临沧市| 甘洛县| 乌苏市| 广南县| 青海省| 大渡口区| 油尖旺区| 康保县| 周至县| 郧西县| 通榆县| 石棉县| 陵川县|