If you start your program from sub main just declare your form as public beofre starting it. If you start from a form you can either pass the instance around through constructors or make some public variable in a module.
To pass instance through constructors:
Let say Form1 is your main form and Form2 is some other form.
In Form2:
Dim formmain as Form 'some variable to hold the instance
'pass in the form instance
Public Sub New(byval mainform as form1) 'get the variable that
'contains the form's instance
MyBase.New
InitializeComponents()
formmain = mainform 'get the instance to a variable that
'can be used in this throughout this class
End Sub
'in some other sub
public sub DoSomething()
formmain.sometextbox.text = "some text" 'use the variable with
'that instance to access the textbox on the form.
end sub
You can do that, or declare a public variable.
You dont need inheritance for that, you just need some functions to accept parameters that you need. Those should easily be implemented in your form class. Database connections dont require any special inheritance.
Inheritance in .NET plays a huge role :) For example every control inherits from the base Control class.
If you put functions in a module you will not be able to inherit at all. If you want to inherit from something create another class. What are you trying to do? It will be easier to explain and get to what you need if I know what you are trying to do :)
If it doesnt inherit from form than the class will not be a form. You cant inherit from anything else if you want to have a form. Create another class and inherit from whatever you need.
I recently started a ASP.NET project. I have a ascx file which I put on my web form. This is a part of my ascx file:
<div align="center"><%#COPYRIGHT%></div>
Then I drag the ascx onto my form.
How can I let the ascx control know of variable copyright from the page? I never worked with ascx files before :rolleyes:
You cant compile Framework 1.1 with VS 2002. You need VS 2003 or use command line compilers. Considering the price you should get yourself that special upgrade for 29$ :)
Wow, that book is old :D ;)
I think you made a good decision. It looks like it has a lot of useful info.
I myself had a book day today :), im tired of going through those tutorials that come with the DX SDK :). And this looks like a pretty good introdution to D3D.
http://www.amazon.com/exec/obidos/ASIN/0672324989/
I never really worked with Crystal Reoprts but I noticed your poll. I wouldnt recommend buying a MS Reference. It contains things that you can find in your help files. Go with something thats not a core reference. You would be better buying some other book to learn then reference.
To me it seems like they will concentrate everything now on developing the SQL server. SQL server hosting CLR? Wouldnt that add more trouble than the .net syntax is worth?
That was just an example of what you can add, you have to type in the actual values :), like:
graphpath.AddEllipse(100, 100, 100, 100) 'just an example values
Use this:
textboxname.Text = InputBox("whatever you have here")
You said you make a simple interface, but when you get into more complicated stuff dont use InputBoxes, they are old, not part of the .NET framework and look ugly :)
I think an XML file would be great for this kind of thing. Its a lot easier to navigate than normal files.
Im still not sure about the rest becuase you didnt answer my question :).
Put this in PropertyValueChanged event:
If e.ChangedItem.Label = "nameofyourproperty" Then
Try
Integer.Parse(e.ChangedItem.Value)
Catch ex As Exception
MsgBox("No numbers!")
End Try
End If