Home All Groups Group Topic Archive Search About
Author
28 Feb 2006 11:12 PM
Andrew Bassett
Hey everyone...
  I have what I hope is a simple question. I have a form with about a dozen
controls bound to a databinding source. That datasource is bound to a
dataset. Without using a binding navigator, how do I do anything with this
thing?? I can't for the life of me figure out how to add, update, etc... Is
this possible without the navigator?

Thanks!!

Author
1 Mar 2006 2:09 AM
Luke Zhang [MSFT]
Hello,

BindingSource component provide some method to add, update records, for
example, to add a record, call AddNew() method; to update, call EndEdit()
method; to remove a record, call remove() mthod. All these can be done
without a navigator.

Hope this help,

Luke Zhang
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Author
1 Mar 2006 6:34 PM
Andrew Bassett
When I try to make this work I run into a problem. I call addnew and then
should be able to call endedit. However, when I do that I keep getting an
error kicked back about null values for columns. This happens with or
without data in my columns. Why is it its not recognizing the values I put
in my text boxes??  Does this make sense? As an example...

If I have a text box called Key and I put something in it I get a null
reference error. But, if after calling AddNew I set the value of my textbox
via code then it recognizes that value.

It seems like maybe I broke something with my databinding but it half way
works ...


Show quoteHide quote
"Luke Zhang [MSFT]" <lukez***@online.microsoft.com> wrote in message
news:$4LuCVNPGHA.616@TK2MSFTNGXA03.phx.gbl...
> Hello,
>
> BindingSource component provide some method to add, update records, for
> example, to add a record, call AddNew() method; to update, call EndEdit()
> method; to remove a record, call remove() mthod. All these can be done
> without a navigator.
>
> Hope this help,
>
> Luke Zhang
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
Author
1 Mar 2006 7:08 PM
Cor Ligthert [MVP]
Andrew,

Was it you that I showed yesterday this sample on our website?

http://www.vb-tips.com/default.aspx?ID=c6c7d9a8-7511-41a1-a488-2e91e5295e7c

Otherwise I hope this helps,

Cor


Show quoteHide quote
"Andrew Bassett" <Flesrouy@community.nospam> schreef in bericht
news:O8NpW7VPGHA.3196@TK2MSFTNGP09.phx.gbl...
> When I try to make this work I run into a problem. I call addnew and then
> should be able to call endedit. However, when I do that I keep getting an
> error kicked back about null values for columns. This happens with or
> without data in my columns. Why is it its not recognizing the values I put
> in my text boxes??  Does this make sense? As an example...
>
> If I have a text box called Key and I put something in it I get a null
> reference error. But, if after calling AddNew I set the value of my
> textbox via code then it recognizes that value.
>
> It seems like maybe I broke something with my databinding but it half way
> works ...
>
>
> "Luke Zhang [MSFT]" <lukez***@online.microsoft.com> wrote in message
> news:$4LuCVNPGHA.616@TK2MSFTNGXA03.phx.gbl...
>> Hello,
>>
>> BindingSource component provide some method to add, update records, for
>> example, to add a record, call AddNew() method; to update, call EndEdit()
>> method; to remove a record, call remove() mthod. All these can be done
>> without a navigator.
>>
>> Hope this help,
>>
>> Luke Zhang
>> (This posting is provided "AS IS", with no warranties, and confers no
>> rights.)
>>
>
>
Author
1 Mar 2006 7:14 PM
Andrew Bassett
I think my problem was the lack of the CurrencyManager. I don't have one of
those anywhere ... Thanks for the quick reply, I'm off to explore.


Show quoteHide quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
news:eIzWUNWPGHA.3944@tk2msftngp13.phx.gbl...
> Andrew,
>
> Was it you that I showed yesterday this sample on our website?
>
> http://www.vb-tips.com/default.aspx?ID=c6c7d9a8-7511-41a1-a488-2e91e5295e7c
>
> Otherwise I hope this helps,
>
> Cor
>
>
> "Andrew Bassett" <Flesrouy@community.nospam> schreef in bericht
> news:O8NpW7VPGHA.3196@TK2MSFTNGP09.phx.gbl...
>> When I try to make this work I run into a problem. I call addnew and then
>> should be able to call endedit. However, when I do that I keep getting an
>> error kicked back about null values for columns. This happens with or
>> without data in my columns. Why is it its not recognizing the values I
>> put in my text boxes??  Does this make sense? As an example...
>>
>> If I have a text box called Key and I put something in it I get a null
>> reference error. But, if after calling AddNew I set the value of my
>> textbox via code then it recognizes that value.
>>
>> It seems like maybe I broke something with my databinding but it half way
>> works ...
>>
>>
>> "Luke Zhang [MSFT]" <lukez***@online.microsoft.com> wrote in message
>> news:$4LuCVNPGHA.616@TK2MSFTNGXA03.phx.gbl...
>>> Hello,
>>>
>>> BindingSource component provide some method to add, update records, for
>>> example, to add a record, call AddNew() method; to update, call
>>> EndEdit()
>>> method; to remove a record, call remove() mthod. All these can be done
>>> without a navigator.
>>>
>>> Hope this help,
>>>
>>> Luke Zhang
>>> (This posting is provided "AS IS", with no warranties, and confers no
>>> rights.)
>>>
>>
>>
>
>
Author
1 Mar 2006 7:38 PM
Andrew Bassett
On your example you have the following line....

        cma = DirectCast(BindingContext(dt), CurrencyManager)

I'm having trouble making that work. If I try this...

cma = DirectCast(Me.Sites_MBindingSource, CurrencyManager)

I get an error stating I cannot convert a binding source to a Currency Manager. How can I make that work?



Show quoteHide quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:eIzWUNWPGHA.3944@tk2msftngp13.phx.gbl...
> Andrew,
>
> Was it you that I showed yesterday this sample on our website?
>
> http://www.vb-tips.com/default.aspx?ID=c6c7d9a8-7511-41a1-a488-2e91e5295e7c
>
> Otherwise I hope this helps,
>
> Cor
>
>
> "Andrew Bassett" <Flesrouy@community.nospam> schreef in bericht
> news:O8NpW7VPGHA.3196@TK2MSFTNGP09.phx.gbl...
>> When I try to make this work I run into a problem. I call addnew and then
>> should be able to call endedit. However, when I do that I keep getting an
>> error kicked back about null values for columns. This happens with or
>> without data in my columns. Why is it its not recognizing the values I put
>> in my text boxes??  Does this make sense? As an example...
>>
>> If I have a text box called Key and I put something in it I get a null
>> reference error. But, if after calling AddNew I set the value of my
>> textbox via code then it recognizes that value.
>>
>> It seems like maybe I broke something with my databinding but it half way
>> works ...
>>
>>
>> "Luke Zhang [MSFT]" <lukez***@online.microsoft.com> wrote in message
>> news:$4LuCVNPGHA.616@TK2MSFTNGXA03.phx.gbl...
>>> Hello,
>>>
>>> BindingSource component provide some method to add, update records, for
>>> example, to add a record, call AddNew() method; to update, call EndEdit()
>>> method; to remove a record, call remove() mthod. All these can be done
>>> without a navigator.
>>>
>>> Hope this help,
>>>
>>> Luke Zhang
>>> (This posting is provided "AS IS", with no warranties, and confers no
>>> rights.)
>>>
>>
>>
>
>
Author
2 Mar 2006 2:47 AM
Luke Zhang [MSFT]
In my test, after call Addnew, the TextBox is changed to blank and I can
type some string in it. Then I click a button to call
bindingSource1.EndEdit() and this work.

Are all of the fileds in bindingSource bound to a control on the form?
Before EndEdit(), is each of these controls has a actual value? When you
get the exception like

Column 'abc' does not allow nulls.

You may check if the field 'abc' is bound to a control (for example, a
TextBox) and if it has a actual value


Luke Zhang
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Author
18 Mar 2006 12:25 PM
Mike Mudliar a.k.a Mudmike
You can do same thing without  Navigator by using –


'Moves data item First
Private Sub btnMoveFirst_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnMoveFirst.Click
        Me.BindingContext(DA, "Employee").Position = 0
End Sub
'Moves data item Last
Private Sub btnMoveLast_Click(ByVal sender As System.Object, ByVal e As  
System.EventArgs) Handles btnMoveLast.Click
        Me.BindingContext(DA, "Employee").Position = Me.BindingContext(DA,
        "Employee").Count - 1
End Sub
'Moves data item Next
Private Sub btnMoveNext_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnMoveNext.Click
        Me.BindingContext(DA, "Employee").Position -= 1
End Sub
'Moves data item Prev
Private Sub btnMovePrev_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnMovePrev.Click
        Me.BindingContext(DA, "Employee").Position += 1
End Sub
'Add New item
Private Sub btnAddNew_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnAddNew.Click
Dim instance As BindingNavigator
Dim value As ToolStripItem
value = instance.AddNewItem
instance.AddNewItem = value
    End Sub
'Delete item
Private Sub btnDel_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnDel.Click
Dim instance As BindingNavigator
Dim value As ToolStripItem
value = instance.DeleteItem
instance.DeleteItem = value
    End Sub
Author
1 Apr 2006 7:57 AM
mikeinthemud
You can do the same without Navigator by using –
'Moves data item First
Private Sub btnMoveFirst_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnMoveFirst.Click
        Me.BindingContext(DA, "TBL").Position = 0
End Sub
'Moves data item Last
Private Sub btnMoveLast_Click(ByVal sender As System.Object, ByVal e As  
System.EventArgs) Handles btnMoveLast.Click
        Me.BindingContext(DA, "TBL").Position = _
        Me.BindingContext(DA,"TBL").Count - 1
End Sub
'Moves data item Next
Private Sub btnMoveNext_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnMoveNext.Click
        Me.BindingContext(DA, "TBL").Position -= 1
End Sub
'Moves data item Prev
Private Sub btnMovePrev_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnMovePrev.Click
        Me.BindingContext(DA, "Employee").Position += 1
End Sub
'Add New item
Private Sub btnAddNew_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnAddNew.Click
Dim instance As BindingNavigator
Dim value As ToolStripItem
value = instance.AddNewItem
instance.AddNewItem = value
    End Sub
'Delete item
Private Sub btnDel_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnDel.Click
Dim instance As BindingNavigator
Dim value As ToolStripItem
value = instance.DeleteItem
instance.DeleteItem = value
    End Sub

As an alternative download IdeaBlade’s DevForce Express and use that for ORM (I don’t work for them – but use it extensively)