Ghanisen
asked on
CheckBox and DataSet/DataBase
Hi,
This is the first time I'm using the CheckBox Control and have to write it's state to a (boolean) DataSet field .
This is the way I'm doing it:
chbSuspend is the CheckBox' name.
Dim dr As DataRow = DsProducts1.Tables("tProdu cts").NewR ow
If chbSuspend.CheckState = CheckState.Checked Then
dr("Discontinued") = chbSuspend.Checked.TrueStr ing
Else : dr("Discontinued") = chbSuspend.Checked.FalseSt ring
End If
DsProducts1.Tables("tProdu cts").Rows .Add(dr)
The updating of the DataSet/DataBase does'nt work. Obviously handling boolean data is the problem.
Can somebody help me? Any help shall be greatly appreciated.
This is the first time I'm using the CheckBox Control and have to write it's state to a (boolean) DataSet field .
This is the way I'm doing it:
chbSuspend is the CheckBox' name.
Dim dr As DataRow = DsProducts1.Tables("tProdu
If chbSuspend.CheckState = CheckState.Checked Then
dr("Discontinued") = chbSuspend.Checked.TrueStr
Else : dr("Discontinued") = chbSuspend.Checked.FalseSt
End If
DsProducts1.Tables("tProdu
The updating of the DataSet/DataBase does'nt work. Obviously handling boolean data is the problem.
Can somebody help me? Any help shall be greatly appreciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I am not very familiar with this, but check CultureInfo class
The CultureInfo class holds culture-specific information, such as the associated language, sublanguage, country/region, calendar, and cultural conventions. This class also provides access to culture-specific instances of DateTimeFormatInfo, NumberFormatInfo, CompareInfo, and TextInfo. These objects contain the information required for culture-specific operations, such as casing, formatting dates and numbers, and comparing strings.
something like
ci = New CultureInfo("en-US")' here use french
The CultureInfo class holds culture-specific information, such as the associated language, sublanguage, country/region, calendar, and cultural conventions. This class also provides access to culture-specific instances of DateTimeFormatInfo, NumberFormatInfo, CompareInfo, and TextInfo. These objects contain the information required for culture-specific operations, such as casing, formatting dates and numbers, and comparing strings.
something like
ci = New CultureInfo("en-US")' here use french
ASKER
I have found a simpler method that works :
Dim dr As DataRow = DsProducts1.Tables("tProdu
....... 'Code for other rows
dr("Discontinued") = chbSuspend.CheckState
.......'Code for other rows
DsProducts1.Tables("tProdu
But I still have one problem: For the column ("Discontinued") I get in my DataGrid "False" or "True" in English whereas my end users speak French. Do you know how I can get the DataGrid to show "Vrai" and "Faux" instead of "True" and "false"?
Thanks for your help.