Jesupriyan

Jesupriyan

  • NA
  • 10
  • 0

How could store and retrieve the Bolded text in richtextbox in MySql using VB.Net

Sep 17 2009 12:54 AM
Hi!,

I am storing the Richtextbox(some bolded text) values using  'richtextbox1.rtf' in MySQL.

 con.Open()
        com = New OdbcCommand("delete from table1", con)
        com = New OdbcCommand("insert into table1 values('" & RichTextBox1.Rtf & "')", con)
        com.ExecuteNonQuery()
        con.Close()
---------------------------------------

After retrieving the values from DB, I will try to displaly using ths code  'Richtextbox1.rtf=dt.rows(0).item(0).tostring'.            


        con.Open()
        adp = New OdbcDataAdapter("select * from table1", con)
        con.Close()
        dset.Tables.Clear()
        adp.Fill(dset)
        If Not dset.Tables(0).Rows.Count = 0 Then
            'Dim str As String = dset.Tables(0).Rows(0).Item(0).ToString
            'RichTextBox2.Text = str

            'Here I have to use like this. It show an error 'File Format is not Valid'
            RichTextBox2.Rtf = dset.Tables(0).Rows(0).Item(0).ToString
        End If

But I got an error like  ' File Format is not Valid '.

If anybody know kindly reply to me. Its very urgent.

Please.

Answers (2)