[PHP]lstSearchDoctor.ItemData(lstSearchDoctor.NewIndex) = mrsDoctorList!DoctorCode[/PHP]
Where DoctorCode as String
[PHP]lstSearchPatient.ItemData(lstSearchPatient.NewInde x) = mrsPatientList!PatientNum[/PHP]
Where PatientNum As Integer
Runtime error (13) data mismatch
Please help
Hello,
You will get the runtime error. type mismatch.
I explain U in Details
Look .itemdata(index as integer) can only hold the Integer value as well as decimal value. i.e is the value should be numeric
like
-
Combo1.AddItem "saikat" 'OK
-
Combo1.ItemData(Combo1.NewIndex) = 23 ' OK
-
Combo1.AddItem "kaushik"
-
Combo1.ItemData(Combo1.NewIndex) = 14'Ok
-
Now when you use numeric value in string like "123" or "123.12" it will convert it
in integer
like 123 ,123 respectively
-
Combo1.AddItem "saikat"
-
Combo1.ItemData(Combo1.NewIndex) = "23.23" 'no error
-
-
Combo1.AddItem "kaushik"
-
Combo1.ItemData(Combo1.NewIndex) = 14 'no error
-
' the code works fine
-
Now come to the main point when you try to assign alphanumeric value like "C123" in .itemdata then it will give you the runtime error.
-
Combo1.AddItem "saikat"
-
Combo1.ItemData(Combo1.NewIndex) = "abc23" ' Error occur
-
Combo1.AddItem "kaushik"
-
Combo1.ItemData(Combo1.NewIndex) = 14 'no error
-
So the conclusation is you can't store alpha-numeric value in itemdata.
I think u mention that the doctor code is string so it may contain code like"D123" Plz check it.
If u want to store the doctor code then use additems property to store it.
Hope I am cleared your confusion. good luck.