you cant acess the forms like vb6 because they are not declared globally. They are just like any other classes that you create. You could create your form in a module so it would be accesibble to your project publicly though
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB ) VB.NET to C# conversion tips!!
It sounds like you are using the formname instead of the instance variable.
So this is what I'd use to make it public?
VB Code:
Dim frm as New Form2
Originally posted by MrPolite you cant acess the forms like vb6 because they are not declared globally. They are just like any other classes that you create. You could create your form in a module so it would be accesibble to your project publicly though
You're probably going to consider me a newbie from now on, but, what's a module?
Eat long and prosper!
If someone helps you, find someone you can help.
If you still have time, click on the darn banner up there and help the forum!
Well a module is like an all shared class so it is global to the application and you don't make objects from it. When you go to 'Add a New Item...' you'll see it here in the dialog that pops up.
I'm a big fan of the End Result, if it gets the job done then don't sweat the details let me do it how I want, and not all rules apply all the time (hence the phrase 'general' rule), BUT..
It is more OOP like to avoid modules, they make these stateless unmanaged objects sort of and usually aren't really needed. Sometimes they are and I don't think its of the devil to use them, but you should see what other ways there are of doing things.
Most applications have a 'main' form and the rest of the application branches from it. So usually you can overload the constructor of a any 'sub' form to pass it the 'main' form and since the 'main' form started the 'sub' form it already has access to its properties and public members.
VB Code:
'add to SubForm
Private frm as Form
Public Sub New(frm as Form) 'you can use the actual form name if you know it
Mybase.New()
New()
Me.frm=frm
End Sub
'then when the main form creates it
dim frm As New SubForm(Me)
frm.Show()
There are other ways with delegates and what not if you need to do something more specific too.
I only write this because this seems to be a very common question. As I said I don't think there is anything really WRONG with doing it the old way (modules) but what if modules aren't in the next version of vb or what if you switch languages to something that doesn't have them. Or just to jive with the whole .NET wave.
Ah, thankyou all for your help. I've gotten my answer. It was in that code that I asked about before.
VB Code:
Dim frm as New Form2
The name of my form is frmResults. This is the code I used:
VB Code:
Dim frmResults as New frmResults
And now I can set all the properties of the form and its contents. The reason I asked if it was possibly what I needed instead of trying it was because I was at Tae Kwon Do at the time.
Thanks again for all you guys's help.
Furry
Eat long and prosper!
If someone helps you, find someone you can help.
If you still have time, click on the darn banner up there and help the forum!