1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

unbound textbox database update

Discussion in 'Scripting & Programming' started by timark, Feb 9, 2008.

  1. timark

    timark New Member

    2
    0
    1
    Can anyone please help with the following fix:-
    In the following sub i am updating the bound data with the tableadapter which works perfectly, however im trying to update the ritchtextbox.rtf to the database before the rest of the record information is saved as unbound if you like, but i am having a problem with the correct syntax.

    Private Sub SaveInformation()
    a)'-------------------------------------------------------------------------------
    'have tried the following but creates exceptions
    'InfoTableAdapter.InfoBindingSource.Item("FIELD_NAME") = RichTextBox1.Rtf
    'InfoBindingSource.Item("FIELD_NAME") = RichTextBox1.Rtf
    '----------------------------------------------------------------------------------


    b)' the following all works fine for the bound controls
    Me.Validate()
    Me.InfoBindingSource.EndEdit()
    Me.InfoTableAdapter.Update(Me.InfoDataSet.Info)
    End Sub

    Can anybody offer some help to section a) please?
     
  2. ManicD

    ManicD Byte Poster

    237
    4
    34


    Not a major guru in programnming here but in most languages i've seen you have to quote things like teh filename....

    e.g. "RichTextBox1.Rtf"
     
    Certifications: MCSA, N+, A+(Tech), ECDL
    WIP: 70-294, 70-298
  3. Fergal1982

    Fergal1982 Petabyte Poster

    4,196
    171
    211
    you dont need to do that. encasing it in quotes denotes it as a string, not an object. The reference for the field entry isnt a filename, its the name of a richtextbox on the form that the OP is trying to pull the contents out of, and put into the SDA.

    Can you post the error details? encase the line of code in a try/catch and put debug.writeline(ex.message) into the catch section. then set a breakpoint on the debug line, and you can capture the ex details (message, innermessage, etc).
     
    Certifications: ITIL Foundation; MCTS: Visual Studio Team Foundation Server 2010, Administration
    WIP: None at present
  4. Fergal1982

    Fergal1982 Petabyte Poster

    4,196
    171
    211
    ummm. correct me if im wrong here, but I dont think InfoTableAdapter.InfoBindingSource.Item would work. As i recall, items in a binding source refer to the record, not the field in question.
     
    Certifications: ITIL Foundation; MCTS: Visual Studio Team Foundation Server 2010, Administration
    WIP: None at present

Share This Page

Loading...