Hello Everybody,

If I'm a Java Newbie I am even more hopeless in VB... I'm using the Trial version of VB 8.

I need to find out why am I getting an InvalidCastException on the line in red... I tried taking the .Text out but then it won't recognize it. Please help!!

Dim nombre As String, seguroSocial As String
Dim horas As Integer, pagoHora As Integer
Dim comision As Integer, dss As Integer, dpm As Integer
Dim salarioBruto As Integer, salarioNeto As Integer

nombre = txtNombreEmpleado.Text
seguroSocial = txtNumeroSeguroSocial.Text
[B]pagoHora = txtPagoPorHora.Text[/B]       
horas = txtHorasTrabajadas.Text

though this is not the correct forum to describe on this matter but anyways here is your answer.

you are attempting implicit datatype conversions or more frankly type casting which is invalid in this context. coz you can't store a text or string value directly to an numeric variable. before doing it make proper type casting like convert string to numbers or numbers to string/characters.

change your code as this :-

pagoHora = Integer.parse(trim(txtPagoPorHora.Text))


pagoHora = val(trim(txtPagoPorHora.Text))

as I can see in your posted code you will again face the same error in the next line also. as horas is an integer variable and you are putting a string value to it. this cannot be done. make proper casting before doing that.

and one more thing my frnd, always check for the right forum before you post your question. this will help you to find or get your answer more quickly and easily. this forum is visual basic 6 and older versions.
For any further post that you might make plz goto Visual Basic.Net Forum.

with best regards

Thanks Shouvik! I'm so new to VB that I didn't even think of posting this on the NET site... Thanks again :-)