Hello, I do not speak English, it's Google who made the translation into French.
My problem is that I can not make a en.vb.net 2010 or a Do While loop that checks the FOR (IsDBNulle) of 30 TextBox, that's the loop that I wrote but si'il a field vacuum in the Access database following error "the error is always" the exception has been handled InvalideCastException "
"Conversion from type 'DBNull to type' string 'is invalid"
With you I hope a solution to my problem and thank you in advance
I have many text boxes on one form (about 30).
Is there anyway to check them all at once to see if they are « IsDBNull » or empty instead of writing out a massive line of code to check each one individually such as
thank you.
My problem is that I can not make a en.vb.net 2010 or a Do While loop that checks the FOR (IsDBNulle) of 30 TextBox, that's the loop that I wrote but si'il a field vacuum in the Access database following error "the error is always" the exception has been handled InvalideCastException "
"Conversion from type 'DBNull to type' string 'is invalid"
With you I hope a solution to my problem and thank you in advance
I have many text boxes on one form (about 30).
Is there anyway to check them all at once to see if they are « IsDBNull » or empty instead of writing out a massive line of code to check each one individually such as
Code:
‘1
If IsDBNull(ds.Tables("Decision").Rows(Place_Enregistrement).Item("Decentralises")) Then
Me.TB_Decentralises1.Text = ""
Else
Me.TB_Decentralises1.Text = ds.Tables("Decision").Rows(Place_).Item(15)
End If
‘2
If IsDBNull(ds.Tables("Decision").Rows(Place_Enregistrement).Item("Decentralises")) Then
Me.TB_Decentralises2.Text = ""
Else
Me.TB_Decentralises2.Text = ds.Tables("Decision").Rows(Place_).Item(16)
End If
‘3
…
Example my "do while", but does not empty fields.
Dim i As Integer
Dim j As Integer
i = 0
j = 16
Do While IsDBNull(ds.Tables("Decision").Rows.Count - 1 < i) = False
'Do While IsDBNull(ds.Tables("Decision").Rows.Count - 1 <> i) = False
If IsDBNull(ds.Tables("Decision").Rows(i).Item(j)) Then
Me. TB_Decentralises1.Text = ""
Me. TB_Decentralises2.Text = ""
Me. TB_Decentralises3.Text = ""
Else
Me. TB_Decentralises1.Text = (ds.Tables("Decision").Rows(Place_Enregistrement).Item(16))
Me. TB_Decentralises2.Text = (ds.Tables("Decision").Rows(Place_Enregistrement).Item(17))
Me. TB_Decentralises3.Text = (ds.Tables("Decision").Rows(Place_Enregistrement).Item(18))
Exit Do
End If
i = i + 1
Loop