| | |
FRMREtrieve
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Aug 2009
Posts: 6
Reputation:
Solved Threads: 0
hey guys i need some a litle help with my vb.
i have a problem with my project
i cant delete a data in a file and i cant split the name,age and id if ever i click it, it will display above of it in FRMRETRIEVE
i have here all my code in the zip file
Private Sub cmdDelete_Click() // IHAVE ALSO PROBLEM
Dim i As Integer //WITH THIS DELETE
If rey.Text(lstData.List) = "true " Then //IT WILL NOT DELETE
If MsgBox("You want to delete this data" & rey.Text) Then
rey.RemoveItem (lstData.ListIndex)
Close #1
End If
End If
End Sub
Private Sub cmdRetrieve_Click()
Dim X As String
Open App.Path & "\rey.txt" For Input As #1
While Not EOF(1)
Line Input #1, X
lstData.AddItem (X)
Wend
Close 1
End Sub
Private Sub cmdSave_Click()
Dim i As Integer
i = lstData.ListIndex
lstData.List(i) = txtID.Text
lstData.List(i) = txtName.Text
lstData.List(i) = txtAge.Text
Open App.Path & "\rey.txt" For Output As #1
For i = 0 To lstData.ListCount - 1
Print #1, lstData.List(i)
Next i
Close 1
End Sub
Private Sub lstData_Click() // I HAVE A PROBLEM WITH THIS AREA
Dim i As Integer //IT WILL NOT SPLIT
//THE AGE,NAME & id
i = lstData.ListIndex // IF I WILL CLICK THE LISTDATA
txtID.Text = lstData.List(i) // IT WILL BE SPLIT IN THE ABOVE
txtName.Text = lstData.List(i)
txtAge.Text = lstData.List(i)
End Sub
i have a problem with my project
i cant delete a data in a file and i cant split the name,age and id if ever i click it, it will display above of it in FRMRETRIEVE
i have here all my code in the zip file
Private Sub cmdDelete_Click() // IHAVE ALSO PROBLEM
Dim i As Integer //WITH THIS DELETE
If rey.Text(lstData.List) = "true " Then //IT WILL NOT DELETE
If MsgBox("You want to delete this data" & rey.Text) Then
rey.RemoveItem (lstData.ListIndex)
Close #1
End If
End If
End Sub
Private Sub cmdRetrieve_Click()
Dim X As String
Open App.Path & "\rey.txt" For Input As #1
While Not EOF(1)
Line Input #1, X
lstData.AddItem (X)
Wend
Close 1
End Sub
Private Sub cmdSave_Click()
Dim i As Integer
i = lstData.ListIndex
lstData.List(i) = txtID.Text
lstData.List(i) = txtName.Text
lstData.List(i) = txtAge.Text
Open App.Path & "\rey.txt" For Output As #1
For i = 0 To lstData.ListCount - 1
Print #1, lstData.List(i)
Next i
Close 1
End Sub
Private Sub lstData_Click() // I HAVE A PROBLEM WITH THIS AREA
Dim i As Integer //IT WILL NOT SPLIT
//THE AGE,NAME & id
i = lstData.ListIndex // IF I WILL CLICK THE LISTDATA
txtID.Text = lstData.List(i) // IT WILL BE SPLIT IN THE ABOVE
txtName.Text = lstData.List(i)
txtAge.Text = lstData.List(i)
End Sub
•
•
Join Date: Mar 2009
Posts: 881
Reputation:
Solved Threads: 164
Okay, to split on the comma (,) you need to use...
THE Split Function!
Then would it not be lstData.RemoveItem(i)?
And now for why you are having so many problems...
Tools>Options>Put a check next to Require Variable Declaration>OK
In future projects this will put Option Explicit at the top of all your forms and modules and will make you declare your variables. This will solve a lot of problems for you. In fact, you could manually put it in at the top of your existing forms and modules and this will help you out by pointing out your mistakes.
Good Luck
THE Split Function!
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Dim MyArray() As String MyArray = Split(lstData.List(i), ",") txtID.Text = MyArray(0) txtName.Text = MyArray(1) txtAge.Text = MyArray(2)
Then would it not be lstData.RemoveItem(i)?
And now for why you are having so many problems...
Tools>Options>Put a check next to Require Variable Declaration>OK
In future projects this will put Option Explicit at the top of all your forms and modules and will make you declare your variables. This will solve a lot of problems for you. In fact, you could manually put it in at the top of your existing forms and modules and this will help you out by pointing out your mistakes.
Good Luck
If anyone has helped you solve your problem, please mark your thread as solved.
Thanks
Thanks
![]() |
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: make excel to display in form like mdi.!pls..help
- Next Thread: howtoadd combo box item in textbox
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





