請教vb.net的多表單
請教vb.net的多表單
我有幾個疑問
1.如何判斷表單的順序?
假如我的表單名稱依序是form1 form3 form4 form2
則在form1的OwnedForms()就會依序為form3 form4 form2
我要如何得知表單的順序呢?
2.
我可以把訊息由form1送到form4
比如
form2a.Label1.Text = Me.Label1.Text
如果我的form4的label1內容想要丟給form1
那該如何寫呢?
比如我在form4內
關於多表單,
Dim form3a As New Form3Private Sub Button1_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Owner.Text = "Form2傳來的消息"
Me.Owner.OwnedForms(1).Text = "Form2_2傳來的消息"
me.Label1.Text =me. '想要抓取form1的label?
End Sub
3.我可以自由的設定表單的owner嗎?
例如我在表單一內設定了以下的語法
那我在表單二或其他表單內可否自由設定其他的form owner
如果不行 那我傳遞資料到其他form 一定得透過owner的方式嗎?
我可否指定表單的名稱傳遞呢?
謝謝!
附上表單一內的語法做為參考
Dim form3a As New Form3
Dim form2a As New Form4 '依據form2產生的物件變數
Dim form4 As New Form2
' Dim form3a As New Form
'form2這一個物件變數擁有form2這一個表單的特性
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
' 必須有一個物件變數指向form2
'由物件變數與form2溝通
'物件變數指 依據某一個物件型態產生的變數
form2a.Text = "Form1傳來的消息"
form3a.Text = "Form1傳來的消息"
form2a.Label1.Text = Me.Label1.Text
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
form2a.Show()
form3a.Show()
form4.Show()
form2a.Owner = Me 'Form2的Owner 是form1
form3a.Owner = Me
form4.Owner = Me
End Sub
--
我有三本書要賣,分別為
VB.NET 2003資料庫實務入門 作者:許舜淵
VisualBasic.net完美的演繹 作者:松橋工作室
Visual Basic.NET程式設計實務 作者:鍾錸 每一本書均賣250元 三本書均有光碟
我住台北 平常上班均是搭乘捷運藍線 所以可於下班時間(下午五點半到六點半),
約在土城到昆陽站 有興趣的,可以回信到我的信箱
--
o ╔╦╦╦╦╦╦╦╗o。心靈交流的橋樑 資訊傳遞的園地 建築夢想的別境 o○。
。╠銘傳╬築夢別境╣ 。 ≡telnet://bbs.mcu.edu.tw≡ o
○╚╩╩╩╩╩╩╩╝○o From:218-169-126-226.dynamic.hi。 ○ 。。
→
01/07 17:53, , 1F
01/07 17:53, 1F
→
01/07 17:53, , 2F
01/07 17:53, 2F
→
01/07 17:54, , 3F
01/07 17:54, 3F
→
01/07 17:54, , 4F
01/07 17:54, 4F
討論串 (同標題文章)
Programming 近期熱門文章
PTT數位生活區 即時熱門文章