your code looks similar to the code below, it does not allow access to all forms, only some. open my code and look. I have approx. 35 forms and I want to use the method of calling them up that I already have if possible, other wise i will have too much code to change.
by the way, i sure as hell hope that you attempt to modify the textbox BEFORE you use the showdialog method. you realise, of course, that no code in form3 will execute until you have closed form2...?!
since you have several forms, you will need to create a base form class which overloads showdialog (note that line 6 is for demo purposes only and should not be included in your production code):
vb.net Code:
Public Class Form2
Private _f As Form
Overloads Sub ShowDialog(ByVal f As Form, ByVal e As MyEventArgs)
_f = f ' _f now holds a reference to Form1, the public properties and fields of which can now be accessed
Me.TextBox1.Text = e.TextString ' writes to the wretched textbox!
Me.ShowDialog(_f)
End Sub
End Class
Public Class MyEventArgs
' whatever needs to be passed to the forms, probably as a collection. this example uses a string only
Private _msg As String
Public Sub New(ByVal msg As String)
_msg = msg
End Sub
ReadOnly Property TextString() As String
Get
Return _msg
End Get
End Property
End Class
You will build MyEventArgs to house the most efficient collection type for handling the info you will be sending to your 30-something forms. You will call derived classes like this:
vb.net Code:
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim f As Form2 = New Form2
Dim fe As MyEventArgs = New MyEventArgs("Hello World")
i notice that most times there seem to be "Line Numbers" in vb.net code or is this just for the forum only?
thanks!!!!!
The line numbers you see in posts on this forum are created by this forum. They have no relation to the line numbers in the original code, if it even came from an IDE. While you can turn line numbers on in VS I don't really see the point. It takes away some space that could otherwise be displaying code for one thing. 24" wide-screen, 1920x1200 monitor in portrait mode and I work with VS maximised all the time and I often wish the screen was wider. I don't know how people cope with smaller monitors. Also, how often do you really need to to see the line numbers? The IDE shows the current line number in the status bar so if you really need to get to a particular line you can using that.
The line numbers you see in posts on this forum are created by this forum. They have no relation to the line numbers in the original code, if it even came from an IDE. While you can turn line numbers on in VS I don't really see the point. It takes away some space that could otherwise be displaying code for one thing. 24" wide-screen, 1920x1200 monitor in portrait mode and I work with VS maximised all the time and I often wish the screen was wider. I don't know how people cope with smaller monitors. Also, how often do you really need to to see the line numbers? The IDE shows the current line number in the status bar so if you really need to get to a particular line you can using that.
The line numbers you see in posts on this forum are created by this forum. They have no relation to the line numbers in the original code, if it even came from an IDE. While you can turn line numbers on in VS I don't really see the point. It takes away some space that could otherwise be displaying code for one thing. 24" wide-screen, 1920x1200 monitor in portrait mode and I work with VS maximised all the time and I often wish the screen was wider. I don't know how people cope with smaller monitors. Also, how often do you really need to to see the line numbers? The IDE shows the current line number in the status bar so if you really need to get to a particular line you can using that.
you've got a 24" wide-screen monitor!?
don't you just see a larger version of the same thing with a big monitor?
you've got a 24" wide-screen monitor!?
don't you just see a larger version of the same thing with a big monitor?
If you have an A4 sheet of paper and an A3 sheet of paper, if the font is the same size on both then you get twice as much text on the A3 sheet. If you were to double the size of the font then then you get the same amount of text at twice the size.
If you've got more pixels on a screen you can fit more on it. If your screen is 1024x768 and you have a window a 1024x768 then it occupies the whole screen. The same form on a screen at 1920x1200 occupies only a fraction of the entire screen.