so to add the control “OpenFileDialog" you drag the control from the tool box to a form "Form1.vb"....correct?
now how do you access the method from a different class "myCommand.vb"
example I have a form1.vb that has the control “OpenFileDialog" named OpenFD.
I then have myCommands,vb where I want to access OpenFD.
how do I do that?
Private Sub getfilename() openFD.InitialDirectory = "C:\" openFD.Title = "Open a Text File" openFD.Filter = "Text Files|*.txt" openFD.ShowDialog() End Sub
In mycommands.vb you create an instance of your form - something like this:
Friend Shared myForm As New form1
Now mycommands can reference the contents of form1 through the instance "myForm", as in myForm.textbox (or whatever form tools you need to access).
If you want the form1 tools to run methods in mycommands, the sub routines need to be declared as Public Shared.
form1.vb can have something like this:
Private Sub somebutton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlescmbFiles.Click
mycommands should have Public Shared Sub processformbuttonclick()
This is a good example - it refers to palettes and containers but containers behaviour is very similar to forms.
Access a broad range of knowledge to help get the most out of your products and services.