Link to home
Start Free TrialLog in
Avatar of Ghanisen
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("tProducts").NewRow

        If chbSuspend.CheckState = CheckState.Checked Then
            dr("Discontinued") = chbSuspend.Checked.TrueString
        Else : dr("Discontinued") = chbSuspend.Checked.FalseString
        End If

        DsProducts1.Tables("tProducts").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.

ASKER CERTIFIED SOLUTION
Avatar of iboutchkine
iboutchkine

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ghanisen
Ghanisen

ASKER

Hi iboutchkine,

 I have found a simpler method that works :

Dim dr As DataRow = DsProducts1.Tables("tProducts").NewRow

....... 'Code for other rows

dr("Discontinued") = chbSuspend.CheckState

.......'Code for other rows

DsProducts1.Tables("tProducts").Rows.Add(dr)

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.
 




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