關(guān)于vb.net跨窗口遍歷的信息

vb.net 歷遍項(xiàng)目的窗體

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

成都創(chuàng)新互聯(lián)公司自2013年創(chuàng)立以來(lái),是專(zhuān)業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目做網(wǎng)站、成都網(wǎng)站建設(shè)網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個(gè)夢(mèng)想脫穎而出為使命,1280元西烏珠穆沁做網(wǎng)站,已為上家服務(wù),為西烏珠穆沁各地企業(yè)和個(gè)人服務(wù),聯(lián)系電話(huà):18982081108

Dim?myAssembly?As?System.Reflection.Assembly?=?System.Reflection.Assembly.GetExecutingAssembly()

Dim?TheTypes?As?Type()?=?myAssembly.GetTypes()

Dim?myType?As?Type

For?Each?myType?In?TheTypes

If?myType.BaseType.ToString?=?"System.Windows.Forms.Form"?Then

ListBox1.Items.Add(myType.Name)

End?If

Next

End?Sub

VB.NET 遍歷 DataGridView

遍歷的例子:

Dim i, j As Integer

For i = 0 To DataGridView1.RowCount - 1

  For j = 0 To DataGridView1.ColumnCount - 1

MsgBox(DataGridView1.Item(j, i).Value)

  Next

Next

注意:與Excel的單元格命名規(guī)則不一樣,這里的 Item(j, i) 中,列號(hào) j 在前,行號(hào) i 在后。

vb.net中如何遍歷程序窗體中的控件?并讀寫(xiě)控件的數(shù)據(jù)。

Public?Sub?GetAllControls(ByVal?InContainer?As?Control,?ByRef?RecieveList?As?ListBox)

For?i?As?Integer?=?0?To?InContainer.Controls.Count?-?1

If?InContainer.Controls.Item(i).Text??""?Then

GetList.Items.Add(InContainer.Controls.Item(i).Text??vbCrLf)

End?If

If?InContainer.Controls.Item(i).Controls.Count??0?Then

GetAllControls(InContainer.Controls.Item(i),?GetList)

End?If

Next

End?Sub

這段代碼可行,但不能遍歷菜單和工具欄,要按需要修改

vb.net panel里的控件如何遍歷

Public?Sub?ReSetText(Control?ctrl)????????

Dim?ct?As?Control

For?Each?ct?In?ctrl.Controls

Try

For?Each?ct2?As?Control?In?ct.Controls

ReSetText(ct2)

Next

Catch

End?Try

If?(TypeOf?ct?Is?TextBox)?Then

ct.Text?=?""

ElseIf?(TypeOf?ct?Is?ComboBox)?Then

Dim?cb?As?System.Windows.Forms.ComboBox?=?DirectCast(ct,?System.Windows.Forms.ComboBox)

cb.SelectedIndex?=?-1

End?If

Next

End?Sub

因?yàn)閠extbox在窗體里的panel里,你只遍歷窗體的控件是不夠的。

vb.net 遍歷正在運(yùn)行的雖有窗口和句柄

For Each i As System.Diagnostics.Process In System.Diagnostics.Process.GetProcesses

Next

關(guān)于遍歷VB.net窗體里面控件的問(wèn)題

可以的,需要判斷控件類(lèi)型并做一下類(lèi)型轉(zhuǎn)換。

For Each c As Control In Me.Controls

If TypeOf(c) Is TextBox Then

Dim t As TextBox = CType(c ,TextBox)

'調(diào)用t的方法即可

End If

Next

網(wǎng)站欄目:關(guān)于vb.net跨窗口遍歷的信息
本文路徑:http://muchs.cn/article44/hjdehe.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供微信小程序、云服務(wù)器、用戶(hù)體驗(yàn)、軟件開(kāi)發(fā)、響應(yīng)式網(wǎng)站Google

廣告

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

外貿(mào)網(wǎng)站建設(shè)