|
-
Jul 30th, 2004, 12:48 AM
#1
Thread Starter
Junior Member
Array problems
ok for whatever reason i always like to make things difficult for myself.... that being said i need major help... heres my pr0blem....
im just tooling around with this "fake" kinda data base i just set up a crap load of textboxes.... Labeled then txtName, txtaddress, txtcar, txtgolf (totally random things). then i made an array
VB Code:
dim array(4,5) as boolean
(because i have 20 text boxes ... 4x5) how would i apply the array to the text boxes... i would like it .... like....
(name) (address) ect
text box textbox
textbox text box
ect ect
plz help
-
Jul 30th, 2004, 01:09 AM
#2
Fanatic Member
like this mate?
VB Code:
Dim t(4, 5) As TextBox
Dim fake(,) As String = {{"name1", "address1", "telno1", "faxno1", "sts1"}, _
{"name2", "address2", "telno2", "faxno2", "sts2"}, _
{"name3", "address3", "telno3", "faxno3", "sts3"}, _
{"name4", "address4", "telno4", "faxno4", "sts4"}}
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim i, j As Integer
Dim x As Integer = 10
Dim y As Integer = 10
For i = 0 To 3
For j = 0 To 4
t(i, j) = New TextBox()
t(i, j).Location = New Point(x, y)
t(i, j).Text = fake(i, j)
Controls.Add(t(i, j))
x += 110
Next
y += 25
x = 10
Next
End Sub
if not, sorry.
-
Jul 30th, 2004, 01:10 AM
#3
You mean like
VB Code:
txtName.Text = myArray(0,0).ToString
I can understand you being a newbie, but that doesn't mean you can't explain your problem well.
-
Jul 30th, 2004, 06:15 AM
#4
PowerPoster
Hi,
mendhak is right. You will have to sort out exactly what you are trying to achieve. We could go on guessing for hours.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Jul 30th, 2004, 07:41 AM
#5
Frenzied Member
what is it you're trying to accomplish in the long run? that might help you out too.
-
Jul 30th, 2004, 05:09 PM
#6
Thread Starter
Junior Member
sorry i was out all day guys..... ok lemme try to break it down into parts........
First i made one form..... Form1 .... i put 4 text boxes in a groupbox, ((3 group boxes total) 4 textboxes in each) a label above each text box( different titles ...doesnt really matter what they are)) ... .
then i made a second form..... Data.vb(or w/e)
put 20 textboxes... in columns of 5 (4 collumns) top of each column is a different label..... SOOOOO lets just take one textbox at a time...
If someone types there name in ( txtName(text box on form1)).. i wish for it to go in the Name collumn on the Data form. i figured i would have to use an array of some sort to automaticlly check if txtName1 (on Data form) is populated , and if it is ...to check the next number of the array (the next txt box.... txtName2)(just a sample of all my code).
is an Array what i should be using?
-
Jul 31st, 2004, 05:33 AM
#7
So you're basically looking to transfer the text from one textbox to another textbox on another form.
When does the actual transfer happen though? Do you want it while the user is entering it (meaning you have two forms open at the same time), or do you want it to occur after you close form1 and open form2?
-
Jul 31st, 2004, 11:34 AM
#8
Thread Starter
Junior Member
hehe i left out the east part....
i have a button on the first form... when user presses it adds the info to the other textboxes on the other form then clears the first forms boxes... the second form never shows up... i just dont know how to create a database lol... so i made my own kinda...
-
Jul 31st, 2004, 11:36 AM
#9
Thread Starter
Junior Member
heres my starting code... maybe u can understand it better
not even sure if an array is what i should use
Data(form2)
VB Code:
Private Sub BtnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnAdd.Click
If Array(1, 1) = False And Array(2, 1) = False And Array(3, 1) = False And Array(4, 1) = False Then
Data.txtName1.Text = (inptname)
Data.txtAddress1.Text = (inptaddress)
Data.txtCar1.Text = (inptcar)
Data.txtGolf1.Text = (inptgolf)
Array(1, 1) = True
Array(2, 1) = True
Array(3, 1) = True
Array(4, 1) = True
Else
Data.txtName2.Text = (inptname)
Data.txtAddress2.Text = (inptaddress)
Data.txtCar2.Text = (inptcar)
Data.txtgolf2.Text = (inptgolf)
Array(1, 2) = True
Array(2, 2) = True
Array(3, 2) = True
Array(4, 2) = True
End If
End Sub
-
Aug 1st, 2004, 12:11 AM
#10
You can do something like this:
VB Code:
'Module
Public arrValues(3, 0) As String
Public intArrSize As Integer = 0
'form
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
intArrSize = intArrSize + 1
ReDim Preserve arrValues(3, intArrSize)
arrValues(0, intArrSize) = TextBox1.Text
arrValues(1, intArrSize) = TextBox2.Text
arrValues(2, intArrSize) = TextBox3.Text
arrValues(3, intArrSize) = TextBox4.Text
End Sub
But then, I'll save my 'comments' for later. Gotta rush now.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|