| View previous topic :: View next topic |
| Author |
Message |
NINTENDO Grandmaster Cheater Supreme
Reputation: 0
Joined: 02 Nov 2007 Posts: 1371
|
Posted: Tue Feb 12, 2008 10:30 am Post subject: {help plx} how do i add a textfield? |
|
|
| Code: | Dim frmMain as form
frmMain.height=400
frmMain.width=600
frmMain.top=0
frmMain.left=0
dim txtuser as textbox
'How do i add this textbox to frmMain? |
I really need help on this one ;-) _________________
Intel over amd yes. |
|
| Back to top |
|
 |
AtheistCrusader Grandmaster Cheater
Reputation: 6
Joined: 23 Sep 2006 Posts: 681
|
Posted: Tue Feb 12, 2008 11:00 am Post subject: |
|
|
txtuser.visible = true
txtuser.load(i think)
txtuser.move(X,Y) |
|
| Back to top |
|
 |
NINTENDO Grandmaster Cheater Supreme
Reputation: 0
Joined: 02 Nov 2007 Posts: 1371
|
Posted: Tue Feb 12, 2008 11:21 am Post subject: |
|
|
| masterkert3 wrote: | txtuser.visible = true
txtuser.load(i think)
txtuser.move(X,Y) |
I'm using vb 08.
Load does not exist. _________________
Intel over amd yes. |
|
| Back to top |
|
 |
killersamurai Expert Cheater
Reputation: 0
Joined: 10 Sep 2007 Posts: 197 Location: Colorado
|
Posted: Tue Feb 12, 2008 11:35 am Post subject: |
|
|
This is how you would want to create a new textbox.
| Code: |
Dim tx As New TextBox()
// Do other things here
Me.Controls.Add(tx)
|
You can set its properties. Then, you use this(me in vb).Controls.Add(<control>) |
|
| Back to top |
|
 |
NINTENDO Grandmaster Cheater Supreme
Reputation: 0
Joined: 02 Nov 2007 Posts: 1371
|
Posted: Tue Feb 12, 2008 11:44 am Post subject: |
|
|
| killersamurai wrote: | This is how you would want to create a new textbox.
| Code: |
Dim tx As New TextBox()
// Do other things here
Me.Controls.Add(tx)
|
You can set its properties. Then, you use this(me in vb).Controls.Add(<control>) |
thx, It's working very good! However i still can't figure out how to refer to frmMain from itside itself.
| Code: | Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim frmMain As New Form
frmMain.Height = 400
frmMain.Width = 600
frmMain.Show()
End Sub
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim txtuser As New TextBox
Me.Controls.Add(txtuser)
End Sub
End Class |
_________________
Intel over amd yes. |
|
| Back to top |
|
 |
XxOsirisxX Grandmaster Cheater Supreme
Reputation: 0
Joined: 30 Oct 2006 Posts: 1597
|
Posted: Tue Feb 12, 2008 11:24 pm Post subject: |
|
|
Sorry, but i don't get what you're asking for about "itside itselft".
So i may be giving a wrong information, but as far i "understand' what you said. I guess is about locate it. So, in that case it may be:
| Code: | Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim frmMain As New Form
frmMain.Height = 400
frmMain.Width = 600
frmMain.Show()
End Sub
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim txtuser As New TextBox
Me.Controls.Add(txtuser)
txtuser.Location = New System.Drawing.Point(50, 20)
End Sub
End Class |
_________________
|
|
| Back to top |
|
 |
NINTENDO Grandmaster Cheater Supreme
Reputation: 0
Joined: 02 Nov 2007 Posts: 1371
|
Posted: Wed Feb 13, 2008 3:03 am Post subject: |
|
|
| XxOsirisxX wrote: | Sorry, but i don't get what you're asking for about "itside itselft".
So i may be giving a wrong information, but as far i "understand' what you said. I guess is about locate it. So, in that case it may be:
| Code: | Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim frmMain As New Form
frmMain.Height = 400
frmMain.Width = 600
frmMain.Show()
End Sub
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim txtuser As New TextBox
Me.Controls.Add(txtuser)
txtuser.Location = New System.Drawing.Point(50, 20)
End Sub
End Class |
|
When i use me then it will pick form1 instead of frmMain. _________________
Intel over amd yes. |
|
| Back to top |
|
 |
AtheistCrusader Grandmaster Cheater
Reputation: 6
Joined: 23 Sep 2006 Posts: 681
|
Posted: Wed Feb 13, 2008 3:49 am Post subject: |
|
|
| then use frmMain.controls.add(txtuser) |
|
| Back to top |
|
 |
NINTENDO Grandmaster Cheater Supreme
Reputation: 0
Joined: 02 Nov 2007 Posts: 1371
|
Posted: Wed Feb 13, 2008 4:37 am Post subject: |
|
|
| masterkert3 wrote: | | then use frmMain.controls.add(txtuser) |
Nevermind, you wouldn't understand.. _________________
Intel over amd yes. |
|
| Back to top |
|
 |
AtheistCrusader Grandmaster Cheater
Reputation: 6
Joined: 23 Sep 2006 Posts: 681
|
Posted: Wed Feb 13, 2008 5:02 am Post subject: |
|
|
| Naablet wrote: | | masterkert3 wrote: | | then use frmMain.controls.add(txtuser) |
Nevermind, you wouldn't understand.. |
ofcourse lol, i dont know anything about VB 2008 |
|
| Back to top |
|
 |
NINTENDO Grandmaster Cheater Supreme
Reputation: 0
Joined: 02 Nov 2007 Posts: 1371
|
Posted: Wed Feb 13, 2008 5:11 am Post subject: |
|
|
| masterkert3 wrote: | | Naablet wrote: | | masterkert3 wrote: | | then use frmMain.controls.add(txtuser) |
Nevermind, you wouldn't understand.. |
ofcourse lol, i dont know anything about VB 2008 |
I wasn't just speaking with you but to all of YOU. _________________
Intel over amd yes. |
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Wed Feb 13, 2008 5:12 am Post subject: |
|
|
| Naablet wrote: | | XxOsirisxX wrote: | Sorry, but i don't get what you're asking for about "itside itselft".
So i may be giving a wrong information, but as far i "understand' what you said. I guess is about locate it. So, in that case it may be:
| Code: | Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim frmMain As New Form
frmMain.Height = 400
frmMain.Width = 600
frmMain.Show()
End Sub
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim txtuser As New TextBox
Me.Controls.Add(txtuser)
txtuser.Location = New System.Drawing.Point(50, 20)
End Sub
End Class |
|
When i use me then it will pick form1 instead of frmMain. |
Me obtains the pointer of the current object you are resided in. In this case with the code you showed here, you are inside the Class of Form1. Me will always be equal to Form1 while you are inside that class. You will have to use the real name of the other forms if you want to call things inside them. _________________
- Retired. |
|
| Back to top |
|
 |
NINTENDO Grandmaster Cheater Supreme
Reputation: 0
Joined: 02 Nov 2007 Posts: 1371
|
Posted: Wed Feb 13, 2008 5:13 am Post subject: |
|
|
I know..
that's kind of the problem? How early are you? but i cannot assign a new class during run now can I. No.. _________________
Intel over amd yes. |
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Wed Feb 13, 2008 5:16 am Post subject: |
|
|
| Naablet wrote: | I know..
that's kind of the problem? How early are you? but i cannot assign a new class during run now can I. No.. |
Any reason you are getting "snotty" with me? I answered your question. You can't just reset 'Me' to what ever you want. It is a language based variable that is set and handled by the IDE/compiler. No reason to get an attitude because you can't get what you want. _________________
- Retired. |
|
| Back to top |
|
 |
NINTENDO Grandmaster Cheater Supreme
Reputation: 0
Joined: 02 Nov 2007 Posts: 1371
|
|
| Back to top |
|
 |
|