Results 1 to 12 of 12

Thread: !! Another Question...Very Important!!!

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2000
    Posts
    37

    Post

    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?

  2. #2
    Addicted Member Smie's Avatar
    Join Date
    Jun 1999
    Location
    Columbus, OH
    Posts
    249

    Post

    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!

  3. #3
    Hyperactive Member
    Join Date
    Jan 2000
    Posts
    355

    Post

    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
    www.cintelsoftware.co.uk

  4. #4

    Thread Starter
    Member
    Join Date
    Jan 2000
    Posts
    37

    Post

    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?

  5. #5
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    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....


  6. #6
    Hyperactive Member
    Join Date
    Jan 2000
    Posts
    355

    Post

    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
    www.cintelsoftware.co.uk

  7. #7

    Thread Starter
    Member
    Join Date
    Jan 2000
    Posts
    37

    Post

    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?

  8. #8
    Hyperactive Member
    Join Date
    Sep 1999
    Posts
    305

    Post

    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

  9. #9
    Hyperactive Member
    Join Date
    Jan 2000
    Posts
    355

    Post

    yeah, u can have arrays in a user defined type, eg. (from one of my own apps)

    Code:
    Public Type Menus
    
    MenuName(5) as string
    MenuPath(5) as string)
    
    end type
    
    Public Menu(5) as Menus
    ------------------
    cintel rules
    www.cintelsoftware.co.uk

  10. #10

    Thread Starter
    Member
    Join Date
    Jan 2000
    Posts
    37

    Post

    I'm using a control array. Can I call on an API for cut/paste?

  11. #11
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527

    Post

    try this, and let me know how it goes
    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


  12. #12

    Thread Starter
    Member
    Join Date
    Jan 2000
    Posts
    37

    Post

    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!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width