PDA

Click to See Complete Forum and Search --> : !! Another Question...Very Important!!!


madd indian
Jan 6th, 2000, 06:44 AM
ok guys, as most of you know, I'm making a tax program. Now I'm using user-defined types for variables. And since a tax form has A LOT of textboxes how will I make the program load all the info from file into those textboxes?

Say a person saves their information. Then how will load into the textboxes when the user loads the file?

Was I clear in explaining or is it still confusing?

BTW, do you guys want to see what I have done so far?

Smie
Jan 6th, 2000, 06:49 AM
If I understand right, you can create a database to store all your information in, and then set the datafield of the text boxes to a certain spot of the database, so it loads and saves just by filling in the text boxes....

again im not quite sure what you mean, I hope this helps!

KENNNY
Jan 6th, 2000, 07:02 AM
yeah just save it to a database and set the datasource (or something like that) property of txtboxes to the relevant part of the database.
the book "Visual Basic In Easy Steps" has a great database tutorial, that goes quite advanced.

------------------
cintel rules :p
www.cintelsoftware.co.uk

madd indian
Jan 6th, 2000, 09:34 AM
but the problem is that i'm not using database. I"m using good ol' binary files.

Also another question, how do I put in code for copying and pasting?

I know you do this "clipboard.setText txtName.SelText"

But the problem is when the program is running and there are many textboxes, I don't know which textbox the user is gonna copy...so wat coding would I use?

Clunietp
Jan 6th, 2000, 10:18 AM
Windows handles the cut copy and paste functions from a textbox automatically, you don't need to code anything if you don't want to.

If you really have a lot of textboxes, I would suggest using a control array or a grid....

KENNNY
Jan 7th, 2000, 02:40 AM
you can know which one the user is gonna copy from - use the index of the control

Clipboard.settext textbox(index).seltext

where index is the index of the textbox.

------------------
cintel rules :p
www.cintelsoftware.co.uk

madd indian
Jan 7th, 2000, 06:08 AM
thanks, but there are more than one control arrays in the program. and they are on many different forms.

also how would I make the program save all the information in the textboxes to a binary file?

Can you have arrays in a user-defined type?

Bob Baddeley
Jan 7th, 2000, 06:31 AM
On the form load event, you could have it open up your binary, get all the values, and in your textbox array you do something like:

For n = 1 to number of textboxes
Get #1,n,Something(n)
Text(n).Text = Something(n)
Next n

I'm not sure that that would work, but I think you might get the idea. Or maybe have an open dialog box that opens up a specific file and that triggers what's above. I don't know arrays, so I don't think the above code is flawless. Good luck.

bob

KENNNY
Jan 7th, 2000, 07:04 AM
yeah, u can have arrays in a user defined type, eg. (from one of my own apps)


Public Type Menus

MenuName(5) as string
MenuPath(5) as string)

end type

Public Menu(5) as Menus


------------------
cintel rules :p
www.cintelsoftware.co.uk

madd indian
Jan 7th, 2000, 11:48 AM
I'm using a control array. Can I call on an API for cut/paste?

da_silvy
Jan 7th, 2000, 01:52 PM
try this, and let me know how it goes :p
this is code for copying - it worked for me

[code]

Private Sub mnuCopy_Click()
If TypeOf Me.ActiveControl Is TextBox Then
Clipboard.SetText Me.ActiveControl.SelText
Else
Exit Sub
End If
End Sub

Private Sub mnuCut_Click()
If TypeOf Me.ActiveControl Is TextBox Then
Clipboard.SetText Me.ActiveControl.SelText
Me.ActiveControl.SelText = ""
Else
Exit Sub
End If
End Sub

Private Sub mnuPaste_Click()
If TypeOf Me.ActiveControl Is TextBox Then
Me.ActiveControl.SelText = Clipboard.GetText
Else
Exit Sub
End If
End Sub
[\code]




------------------
david
Teenage Programmer

madd indian
Jan 9th, 2000, 08:04 AM
Thank you Dal_silvy for that code, but unfortunately that did not work! Nothing happens when I execute it.

I am an teenage programmer too!