hi! im new here and i need some of your knowledge about database and vb 6. im using MS Access. i always get an error on editing a textbox control array? does any one knows how to code the textbox control array? thanks
what do you mean dynamically create a text box? elaborate more on the problem please also your code (the code where you had an error) will make it easy for us to help you
you dont need an array of textboxes to update a database, you can use a listview to view all the data then you can select each item then display it on a textbox to edit..
here's an example of a listview on click event
Private Sub ListVw_ItemClick(ByVal Item As MSComctlLib.ListItem)
dim LS as Listview
Set LS = ListVw.ListItems.Item(1)
txtClientID = Item
txtLoanAccount = Item.SubItems(1)
txtname = Item.SubItems(2)
txtAddress1 = Item.SubItems(3)
txtAddress2 = Item.SubItems(4)
txtAddress3 = Item.SubItems(5)
End Sub
Private Sub Listview1_ItemClick(ByVal Item As MSComctlLib.ListItem)
Dim LS As ListView
Set LS = Listview1.ListItems.Item(1) <-----Type mismatch---pointing here
txtEdit = Item
txtEdit = Item.SubItems(0)
Call bind
End Sub
======
if i place 1 with 0 the error is Index out of bounds
Last edited by sangkay; December 1st, 2005 at 04:20 AM.
LS is defined as a ListView.
ListView1.ListItems.Item(1) however is a ListItem.
So you can't equate the two. You need to modify the code to be as follows:
Code:
Private Sub Listview1_ItemClick(ByVal Item As MSComctlLib.ListItem)
Dim LS As ListItem
Set LS = Listview1.ListItems.Item(1)
txtEdit = Item
txtEdit = Item.SubItems(0)
Call bind
End Sub
You should also do some kind of error trapping to make sure that ListItem(1) exists.
Also, what is txtEdit? A TextBox? If so, the code:
txtEdit = Item
txtEdit = Item.SubItems(0)
makes little sense. I think you maybe want to do the following:
txtEdit.Text = Item.SubItems(0)
(But obviously you'll know more about what you are trying to do here than I).
I hope that helps you a bit.
hi pinky98, got question again..
how to update this table, i tried but every time i save it all data are change. the table has this data:
(FieldNames)
Name__________ Nickname_____Age
(data)
Nick______________little________7
Nick______________big________17
i would like to change the Nickname "little" to "little nick" but the data under "Nick" are change.
can you help me with this.
Last edited by sangkay; December 5th, 2005 at 10:04 PM.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.