473,385 Members | 1,772 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,385 software developers and data experts.

form instances!!

Hi,

I am having trouble when trying to open up form instances.
When i currently click on a button (button1) in form1 i
open up form2,
However when i go back to my homepage (form1) and click
button1 again i get another instance of form2 opening
instead of the same form!!

I have tried the following code to make the forms globbaly
available but for some reason i keep getting an error
message. here is my code (i created a new class at the top
of the code editor)....

Public Class myForms
Private Shared m_form2 As form2
Public Shared Property form2() As form2
Get
Return m_form2
End Get
Set(ByVal Value As form2)
m_form2 = Value
End Set
End Property
End Class

i then added the following code to the button1

Dim myform2 As New form2()
myform2.Show()
myForms.form2= myform2

is this the right way to go about it or is there an easier
way?? im new to vb.net and am very confused!!

i got this code example from...
http://msdn.microsoft.com/library/default.asp?
url=/library/en-
us/dv_vstechart/html/vbtchworkingwithmultipleformsinvisualb
asicnetupgradingtonet.asp

here is the error message i keep recieveing. The code
seems to stop in the windows genereated code for my
form1...

An unhandled exception of
type 'System.Resources.MissingManifestResourceException '
occurred in mscorlib.dll

Additional information: Could not find any resources
appropriate for the specified culture (or the neutral
culture) in the given assembly. Make
sure "frmHome.resources" was correctly embedded or linked
into assembly "Caravan".
baseName: frmHome locationInfo: Caravan.frmHome resource
file name: frmHome.resources assembly: Caravan,
Version=1.0.1464.24080, Culture=neutral,
PublicKeyToken=null

i appreciate any help anyone can offer :o)
thx
Jul 21 '05 #1
1 1176
Cor
Hi Tonya,

I once made this form with a different approach

Look if it works for you?

Cor

Hi x

\\\form1
Private WithEvents frm3 As New Form3
Private WithEvents frm2 As New Form2
Private Sub frm2_VisibleChanged(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles frm2.VisibleChanged
If frm2.inputfield <> "" Then
Me.Show()
Me.Label1.Text = frm2.inputfield
frm2.Dispose()
End If
End Sub
Private Sub frm3_VisibleChanged(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles frm3.VisibleChanged
If frm3.inputfield <> "" Then
Me.Show()
Me.Label1.Text = frm3.inputfield
frm3.Dispose()
End If
End Sub

Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
frm3.Show()
frm3.TopLevel = True
frm2.Show()
frm2.TopLevel = True
End Sub
///
\\\form2 and 3 the same
Public inputfield As String
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click

inputfield = "sometext"
Me.Hide()
End Sub
///


Jul 21 '05 #2

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

Similar topics

4
by: Tonya | last post by:
Hi, Does anyone have any example of how i can manage forms in my application?? I want to be able to reference my form instances that are currently open from other forms. why cant i open...
18
by: Jan Nielsen | last post by:
Hi I have a main form showing personal information (name, address etc.) bound to a dataset. One of the pieces of information is the Group the person belongs to. This is selected from a combo box....
3
by: Hifni Shahzard | last post by:
Hi, I'm using VS.NET 2003. I've a small problem using the OOP concepts. I want to know before creating an instance of a class, to check whether any instances earlier created exists. Now for...
1
by: Tonya | last post by:
Hi, I am having trouble when trying to open up form instances. When i currently click on a button (button1) in form1 i open up form2, However when i go back to my homepage (form1) and click...
7
by: Oenone | last post by:
I'm sure I read some time back that in VB 2005, MS were re-introducing the concept of default form instances, so that if I have a form named MyForm I can simply call MyForm.Show without having to...
5
by: Neil | last post by:
"lyle" <lyle.fairfield@gmail.comwrote in message news:48c3dde7-07bd-48b8-91c3-e157b703f92b@f3g2000hsg.googlegroups.com... Question for you. I'm doing something similar, only, instead of opening...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.