 |
|
|
 |
 |
|
ไม่มีใครช่วยเลย
หรือว่างงคำถามครับ
คือใน vb เวลาสั่ง close form ให้ตรวจจับข้อมลก่อนอะครับ ทำไง
|
 |
 |
 |
 |
Date :
2009-07-19 10:29:30 |
By :
zerocool |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ผมอ่านแล้วงง ในการสร้าง ฟอร์ม ของคุณ ช่วยกรุณาอธิบายใหม่ ครับ
|
 |
 |
 |
 |
Date :
2009-07-20 15:05:00 |
By :
lee_latee |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คือต้องการทำ MDI แหละครับ แต่ผมบังคับการเปิด form ได้แค่ 1 form ไม่เป็นครับ ก็เลยคิดว่าอยากจะ disable เมนูที่มีการคลิกเปิด form นั้นไว้ไม่ให้กดเป็นครั้งที่ 2 ครับ
|
 |
 |
 |
 |
Date :
2009-07-22 20:16:11 |
By :
zerocool |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ประมาณนี้ได้ไหมครับ
Code (VB.NET)
pubilc class FrmMain ()
Private Sub MenuFrmOne_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuFrmOne.Click
Dim CurrentForm As Form
'' ค้นหาฟอร์มนี้ว่ามีเปิดอยู่หรือไม่
For Each CurrentForm In Me.MdiChildren
If TypeOf CurrentForm Is FrmOne Then
CurrentForm.MdiParent = Me
CurrentForm.Show()
''ถ้ามีก็ฟ้อง Msgbox
MessageBox.Show("!!!ฟอร์มนี้เปิดใช้งานอยู่แล้ว!!!", "ผมการตรวจสอบ", MessageBoxButtons.OK, MessageBoxIcon.Question)
Exit Sub
End If
Next
''ถ้าไม่มีก็ให้โชว์ฟอร์มนี้
Dim frmNew As New FrmOne
frmNew .MdiParent = Me
frmNew .Show()
End Sub
**ไม่รู้ตรงกับความต้องการหรือไม่
ผิดพลาดประการใดก็ ขอ อภัย ด้วยครับ
tee
|
 |
 |
 |
 |
Date :
2009-07-23 09:54:27 |
By :
lee_latee |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แค่ยินดีตอบผมก็สุดซึ้งแล้วครับ
|
 |
 |
 |
 |
Date :
2009-07-23 14:06:05 |
By :
zerocool |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คุณ lee_latee ครับ รบกวนอรกนิดครับ
โค๊ดที่ให้มาตรงครับ แต่ยังติดปัญหานิดครับ คือถ้าเป็น 1 form ไม่มีปัญหาอะไรครับ แต่ถ้าเปิด 2 form ขึ้นไป มัน error บันทัดนี้ครับ For Each CurrentForm In Me.MdiChildren ไม่ทราบว่าผมเขียน code ผิดตรงไหนหรอครับ
Code (VB.NET)
Public Class Form1
Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click
Dim CurrentForm As Form2 '' ค้นหาฟอร์มนี้ว่ามีเปิดอยู่หรือไม่
For Each CurrentForm In Me.MdiChildren
If TypeOf CurrentForm Is Form2 Then
CurrentForm.MdiParent = Me
CurrentForm.Show() ''ถ้ามีก็ฟ้อง Msgbox
MessageBox.Show("!!!ฟอร์มนี้เปิดใช้งานอยู่แล้ว!!!", "ผมการตรวจสอบ", MessageBoxButtons.OK, MessageBoxIcon.Question)
Exit Sub
End If
Next ''ถ้าไม่มีก็ให้โชว์ฟอร์มนี้
Dim frmNew As New Form2
frmNew.MdiParent = Me
frmNew.Show()
End Sub
Private Sub CloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloseToolStripMenuItem.Click
Dim CurrentForm As Form3 '' ค้นหาฟอร์มนี้ว่ามีเปิดอยู่หรือไม่
For Each CurrentForm In Me.MdiChildren
If TypeOf CurrentForm Is Form3 Then
CurrentForm.MdiParent = Me
CurrentForm.Show() ''ถ้ามีก็ฟ้อง Msgbox
MessageBox.Show("!!!ฟอร์มนี้เปิดใช้งานอยู่แล้ว!!!", "ผมการตรวจสอบ", MessageBoxButtons.OK, MessageBoxIcon.Question)
Exit Sub
End If
Next ''ถ้าไม่มีก็ให้โชว์ฟอร์มนี้
Dim frmNew As New Form3
frmNew.MdiParent = Me
frmNew.Show()
End Sub
End Class
|
 |
 |
 |
 |
Date :
2009-07-27 13:27:14 |
By :
zerocool |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
โทษทีครับรีบไปหน่อยผิดตรงนี้ครับ
Code (VB.NET)
Public Class Form1
Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click
Dim CurrentForm As Form ''**************************** แก้ตรงนี้ครับ
For Each CurrentForm In Me.MdiChildren
If TypeOf CurrentForm Is Form2 Then
CurrentForm.MdiParent = Me
CurrentForm.Show() ''ถ้ามีก็ฟ้อง Msgbox
MessageBox.Show("!!!ฟอร์มนี้เปิดใช้งานอยู่แล้ว!!!", "ผมการตรวจสอบ", MessageBoxButtons.OK, MessageBoxIcon.Question)
Exit Sub
End If
Next ''ถ้าไม่มีก็ให้โชว์ฟอร์มนี้
Dim frmNew As New Form2
frmNew.MdiParent = Me
frmNew.Show()
End Sub
Private Sub CloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloseToolStripMenuItem.Click
Dim CurrentForm As Form ''******************************** แก้ตรงนี้ครับ
For Each CurrentForm In Me.MdiChildren
If TypeOf CurrentForm Is Form3 Then
CurrentForm.MdiParent = Me
CurrentForm.Show() ''ถ้ามีก็ฟ้อง Msgbox
MessageBox.Show("!!!ฟอร์มนี้เปิดใช้งานอยู่แล้ว!!!", "ผมการตรวจสอบ", MessageBoxButtons.OK, MessageBoxIcon.Question)
Exit Sub
End If
Next ''ถ้าไม่มีก็ให้โชว์ฟอร์มนี้
Dim frmNew As New Form3
frmNew.MdiParent = Me
frmNew.Show()
End Sub
End Class
|
 |
 |
 |
 |
Date :
2009-07-27 17:34:46 |
By :
lee_latee |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณมากคับ ได้แล้วครับ
|
 |
 |
 |
 |
Date :
2009-07-27 18:15:44 |
By :
zerocool |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คัยว่างมั่งค่ะ แก้มอยากปรึกษาเรื่อง MDI Form หน่อยอ่าค่ะ
พอดีต้องทำโปรเจ็กส่งพรุ่งนี้
พี่ ๆ คนไหนว่างแอ๊ดมาสอนหน่อยนะค่ะ
จะขอบคุงมากมายรุย
[email protected] น๊า
|
 |
 |
 |
 |
Date :
2010-01-29 12:55:29 |
By :
นู๋แก้ม |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณอีกคนค๊าบบบ
|
 |
 |
 |
 |
Date :
2011-10-07 15:42:13 |
By :
Phromthet |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (VB.NET)
My.Forms.Form2.MdiParent = Me
My.Forms.Form2.Show()
|
 |
 |
 |
 |
Date :
2014-01-02 12:47:58 |
By :
vishai jaidee |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณมากครับ
กำลังหาโค้ดตรวจสอบ Form ที่เปิดแล้วอยู่พอดีเลย
เคยทำแต่ C#
มาทำใน VB แล้วไปไม่เป็นเลยครับ
 
|
 |
 |
 |
 |
Date :
2015-09-08 15:14:08 |
By :
t2dear_ict |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|