mcanepa
asked on
Extracting data from a string...HELP!
I need to select data from a sting (in a listbox).
The string in the list box is this:
(txtEmployeeName.Text & ":" & vbTab & txtSsn.Text & ":" & vbTab & txtPieceWork.Text)
I need to extract the piecework integer (txtPieceWrk.Text)from the string in order to calculate it with the price.
So far I have this, but I keep getting error messages:
NOTE: PieceWorkPay is a private function.
strEmplySel = lstEmployee.List(lstEmploy ee.ListInd ex)
intPieWrk = InStr(1, strEmplySel, ":")
If intPieWrk > 0 Then
sngTotal = PieceWorkPay(Mid$(strEmply Sel, intPieWrk + 1))
End If
Please Help!
Thanks,
Maryann
The string in the list box is this:
(txtEmployeeName.Text & ":" & vbTab & txtSsn.Text & ":" & vbTab & txtPieceWork.Text)
I need to extract the piecework integer (txtPieceWrk.Text)from the string in order to calculate it with the price.
So far I have this, but I keep getting error messages:
NOTE: PieceWorkPay is a private function.
strEmplySel = lstEmployee.List(lstEmploy
intPieWrk = InStr(1, strEmplySel, ":")
If intPieWrk > 0 Then
sngTotal = PieceWorkPay(Mid$(strEmply
End If
Please Help!
Thanks,
Maryann
intPieWrk = InStrRev(strEmplySel, vbTab)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
dim arFields() as string
arfields=split(txtEmployee
this will give you this array:
arFields(0)=txtEmployeeNam
arFields(1)=txtSsn.Text
arFields(1)=txtPieceWork.t
Hope this helps
the most simple way would be to try this :
*smiles*
msgbox txtPieceWork.Text
*smiles*
msgbox txtPieceWork.Text
Dim l() as string
Dim str as string
Dim strPieceWork as string
str=txtEmployeeName.Text & ":" & vbTab & txtSsn.Text & ":" & vbTab & txtPieceWork.Text
l=Split(str, vbTab, vbTextCompare)
strPieceWork = l(2)
Dim str as string
Dim strPieceWork as string
str=txtEmployeeName.Text & ":" & vbTab & txtSsn.Text & ":" & vbTab & txtPieceWork.Text
l=Split(str, vbTab, vbTextCompare)
strPieceWork = l(2)