form1 is a class not a module, you cant just access one of its subrutines unless it's declared as SHARED.
You should do something like this:
dim frm as form1 ' create a new form1
frm.hello("hello world")
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!!
i call a subroutine in the module from the form but that module calls a sub in the form and it has to be the same instance of the form is that possible?
would frm be the existing instance of form1? or would it create a new one?
it creates a new one
You can pass the form as an argument to the function that you are calling, but I wouldnt recommend it You could also use delegates, but the easiest way is to declare your sub as shared (I guess you could just put the code in a module rather than accessing it from the form, but anyways if you wanna do it this way, this should work: )
Public Shared Sub Hello(byval strString as string)
Code Here
End Sub
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!!
Put a variable in the module that will hold a reference to the form you want to call a sub on. Then set that module variable either with the forms load event or from somewhere else before your module will call that forms sub.
Originally posted by hellswraith Put a variable in the module that will hold a reference to the form you want to call a sub on. Then set that module variable either with the forms load event or from somewhere else before your module will call that forms sub.
or use a delegate
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!!
ok i am more of a novice programmer and have no clue what some of this stuff your saying is.......could you be more elaborate and include some code samples?
when i use a shared sub i cant control any objects in the form class. what can i do cuz this sub in the form class (that im calling from an external module) must controll an object in the form class
don't think you cann. VB.Net is fully object oriented. Also a form is an object. If an object doesn't exist how can you call a method of the object that doesn't exist. I think Java supports this (calling methods from the wrapper class) but vb.net not doesn't really support this.
Last edited by robbedaya; Feb 15th, 2003 at 04:08 AM.
- Use the thread tools to Mark your Thread as Resolved when your question is answered.
- Please Rate my answers if they where helpful.
what you are suggestig to do is to check first of an instance of your form exists, right? So an instance has to be loaded. How do you create that instance of your form? by seting it startup-form or by loading it in another form. If you don't load this form somewhere else myForm1 will always be nothing.
- Use the thread tools to Mark your Thread as Resolved when your question is answered.
- Please Rate my answers if they where helpful.
ok the form instance loads on start up.......would it work if i used the sub Main in the module as start up and create a new instance of the form from the module???? then would i be able to do what i wanna do? or does hells idea work if the form is loaded on start up?