473,397 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

the form already on loaded...

dim frm2 as new form2
frm2.mdiparent =me
frm2.name="eu.undernet.org"
frm2.show()
every time i clicked on menu , the new frm2 is added again. how do i
prevent if frm2 is already on loaded.
i'm working on irc chat similar to mirc.
regards,

Nov 20 '05 #1
5 1043
Hi Supra,

I made this method for it.
(Wherin I added an improvement Jef pointed me on).

I hope it works for you?

Cor
\\\
Private Sub mnuFrmHandling(ByVal frmName As String)
For Each frm As Form In Me.MdiChildren
If frm.Name = frmName Then
frm.BringToFront()
Exit Sub
End If
Next
Dim frmNew As Form
Select Case frmName
Case "Persons"
frmNew = New frmPersons
Case "Actions"
frmNew = New frmActions
Case Else
frmNew = New frmTabellen(frmName)
End Select
frmNew.MdiParent = Me
frmNew.Show()
frmNew.WindowState = FormWindowState.Maximized
frmNew.Name = frmName
frmNew.BringToFront()
End Sub
///

I hope this helps?

Cor
Nov 20 '05 #2
* Supra <su*****@rogers.com> scripsit:
dim frm2 as new form2
frm2.mdiparent =me
frm2.name="eu.undernet.org"
frm2.show()
every time i clicked on menu , the new frm2 is added again. how do i
prevent if frm2 is already on loaded.

i'm working on irc chat similar to mirc.


Do a Google search for the Singleton design pattern and implement this
design pattern in your forms that should only be shown once.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 20 '05 #3
Herfried,

Did you look at the method I made, it is really very nice after that Jef
told that I had made something to much in it. It started as a simple sample
for Charles.

(I write this more because I did not expect you today)

:-)

Cor
Nov 20 '05 #4
thank lightert. this is what i'm looking for:

For Each frm As Form In Me.MdiChildren
If frm.Name = frmName Then
frm.BringToFront()
Exit Sub
End If
Next

many thank to u.
regards,


Cor Ligthert wrote:
Herfried,

Did you look at the method I made, it is really very nice after that Jef
told that I had made something to much in it. It started as a simple sample
for Charles.

(I write this more because I did not expect you today)

:-)

Cor


Nov 20 '05 #5
Private Sub mnuInfo_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles mnuInfoAlias.Click, mnuInfoStart.Click,
mnuInfoChan.Click
Dim mi As MenuItem = CType(sender, MenuItem)
Select Case mi.Text
Case "Aliases..."
mnuFrmHandling(mi.Text)
Case "Startup..."
mnuFrmHandling(mi.Text)
Case "Channels..."
mnuFrmHandling(mi.Text)
End Select
End Sub

Private Sub mnuFrmHandling(ByVal frmName As String)

For Each frm As Form In Me.MdiChildren
If frm.Name = frmName Then
frm.BringToFront()
Exit Sub
End If
Next

Dim frmNew As frmAlias
frmNew = New frmAlias
frmNew.MdiParent = Me
frmNew.Name = frmName

Select Case frmName
Case "Aliases..."
frmNew.Text = frmName

Case "Startup..."
frmNew.Text = frmName

Case "Channels..."
frmNew.Text = frmName
Case "DCC CHAT"
Case "DCC SEND"
Case "FILE TRANSFER"
Case "BAN"
Case "KICK"
Case "JOIN"
Case "PART"
Case "QUIT"
End Select
frmNew.Show()
End Sub
regards,

Cor Ligthert wrote:
Herfried,

Did you look at the method I made, it is really very nice after that Jef
told that I had made something to much in it. It started as a simple sample
for Charles.

(I write this more because I did not expect you today)

:-)

Cor


Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Supra | last post by:
how do i prevented form is already loaded. i had mdichild form when i clicked menu to show form. using visual studio 2003 in vb.net.
1
by: Konstantin | last post by:
Can someone help me figure out a way to open a form only once in an MDI app. I have an MDI app that contains several forms. I use each form depending on the type of document that the user needs...
25
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the...
2
by: David N | last post by:
Hi All, The OnLoad() event is invoked automatically when a form is being loaded. Do we have another event that is invoked automatically after a form has completed loading? Thanks.
3
by: Cc | last post by:
does event onload mean form already loaded or before loaded? I make a form and I inherit that form on another form, when I run, it execute the process on the parent form without showing the form on...
15
by: http://www.visual-basic-data-mining.net/forum | last post by:
Does anyone have any idea how to transferring data from TextBox1 in form1 to textBox2 in form2..... That means after i fill in any data in textBox1 and click Next button... It will bring me to...
2
by: Billy | last post by:
Hello! I have a main form as MDIContainer in VB.NET 2002 App. Form has menu which call several forms. I call forms that way: -- Dim f As New frmNameX() LoadForm(f) -- Procedure LoadForm...
4
by: Arsalan | last post by:
In MDI interface, suppose i have a form named "FORM" , how do i check if its already loaded or not ??
8
by: PAPutzback | last post by:
How do I keep the form up.
4
by: David | last post by:
Hi, I have a MAINFORM with a pop-up form link and a textfield The POPUPFORM displays 3 columns (1) Description : (2) £Charge : (3) Checkbox Each charge will be different for the various...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.