PC Review


Reply
Thread Tools Rate Thread

Checkbox and Databinding at Design time

 
 
M
Guest
Posts: n/a
 
      19th Aug 2004
I binding controls to a dataset at design time.
I find the checkboxs will cause the program crash when one of these
databinding fields is dbnull.
The only way for me is not set databindings for the checkboxs and adding
code after fill the dataset and before update the dataset.
I bind them to the checked property
Is there some easy way to set databinding for checkbox?

Thanks


 
Reply With Quote
 
 
 
 
One Handed Man \( OHM - Terry Burns \)
Guest
Posts: n/a
 
      19th Aug 2004
MyCheckBox.DataBindings.Add( . . . . .

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing

"M" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I binding controls to a dataset at design time.
> I find the checkboxs will cause the program crash when one of these
> databinding fields is dbnull.
> The only way for me is not set databindings for the checkboxs and adding
> code after fill the dataset and before update the dataset.
> I bind them to the checked property
> Is there some easy way to set databinding for checkbox?
>
> Thanks
>
>



 
Reply With Quote
 
M
Guest
Posts: n/a
 
      19th Aug 2004
I do not see any differnce from set data binding at design time.
It still will cause the prgram crash if the field is dbnull.

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:(E-Mail Removed)...
> MyCheckBox.DataBindings.Add( . . . . .
>
> --
>
> OHM ( Terry Burns )
> . . . One-Handed-Man . . .
> If U Need My Email ,Ask Me
>
> Time flies when you don't know what you're doing
>
> "M" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > I binding controls to a dataset at design time.
> > I find the checkboxs will cause the program crash when one of these
> > databinding fields is dbnull.
> > The only way for me is not set databindings for the checkboxs and adding
> > code after fill the dataset and before update the dataset.
> > I bind them to the checked property
> > Is there some easy way to set databinding for checkbox?
> >
> > Thanks
> >
> >

>
>



 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      19th Aug 2004
M,

Because your database item is not the same type as your databinding would
expect. therefore I think you can surely not do it at design time.

You can try to use the binding events


http://msdn.microsoft.com/library/de...ventstopic.asp

click on the member there is more information.

I hope this helps?

Cor


 
Reply With Quote
 
M
Guest
Posts: n/a
 
      19th Aug 2004
Right Now I am using
'Fill Dataset
If MyDs.tables(0).Columns.Item(1) Is System.DBNull.Value Then
MyDs.tables(0).Columns.Item.Rows(0).Item(1) = False
End If

and

'Update dataset
MyDs.tables(0)..Rows(0).Item("GuidelinesMaxReg") = Me.Chkbox.Checked

It works

But I think Textbox or c1NumericEdit accept binding to field which value may
be dbNull.value.
If there are some properties can be set and make the checkbox also can do
that way and save me some coding.


 
Reply With Quote
 
Scott Meddows
Guest
Posts: n/a
 
      20th Aug 2004
M,

Can you assign a default value to that column in your database?

"M" <(E-Mail Removed)> wrote in message news:etj%(E-Mail Removed)...
> Right Now I am using
> 'Fill Dataset
> If MyDs.tables(0).Columns.Item(1) Is System.DBNull.Value Then
> MyDs.tables(0).Columns.Item.Rows(0).Item(1) = False
> End If
>
> and
>
> 'Update dataset
> MyDs.tables(0)..Rows(0).Item("GuidelinesMaxReg") = Me.Chkbox.Checked
>
> It works
>
> But I think Textbox or c1NumericEdit accept binding to field which value may
> be dbNull.value.
> If there are some properties can be set and make the checkbox also can do
> that way and save me some coding.
>
>



 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      20th Aug 2004
M,

I did not test it, (copied from a program and changed somewhat) you can try
it in this way.

Maybe you can try it for yourself?

Cor
\\\
Dim Mybinding as New Binding("Checked", dv, "MyCheckItem")
AddHandler Mybinding.Format, AddressOf DBtoCheckbox
////
\\\
Private Sub DBtoCheckbox(ByVal sender As Object, _
ByVal cevent As ConvertEventArgs)
If cevent.Value Is DBNull.Value Then
cevent.Value = False
End If
End Sub
///

> Right Now I am using
> 'Fill Dataset
> If MyDs.tables(0).Columns.Item(1) Is System.DBNull.Value Then
> MyDs.tables(0).Columns.Item.Rows(0).Item(1) = False
> End If
>
> and
>
> 'Update dataset
> MyDs.tables(0)..Rows(0).Item("GuidelinesMaxReg") = Me.Chkbox.Checked
>
> It works
>
> But I think Textbox or c1NumericEdit accept binding to field which value

may
> be dbNull.value.
> If there are some properties can be set and make the checkbox also can do
> that way and save me some coding.
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hell = ComboBox databinding at design time =?Utf-8?B?RGF2aWQgTWNDbGVsbGFuZA==?= Microsoft Dot NET Framework Forms 2 17th Mar 2006 03:53 PM
ComboBox design-time DataBinding setting questions. dbuchanan Microsoft Dot NET Framework Forms 3 1st Feb 2006 12:15 PM
ComboBox design-time DataBinding setting questions. dbuchanan Microsoft Dot NET 3 1st Feb 2006 12:15 PM
ComboBox design-time DataBinding setting questions. dbuchanan Microsoft VB .NET 3 1st Feb 2006 12:15 PM
design time databinding Stephen Microsoft VB .NET 1 3rd Oct 2003 09:34 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:06 PM.