Hi Daniweb,

I spend a lot of time googling this problem and found no answer yet. The problem is I added a new column in my table, I have a dataset linked to that table and a source of data of my datagridview.

Now, when I'm going to add a new column into my datagridview, I didn't find the new column which I added recently. Seems that the binding source is not updating whenever an update takes place.

How could I add the new column without having to assign a new dataset again into my datagridview?

Thanks in advanced Daniweb.

Sincerely,

Charlie

in your query add your new field there...
ex.

Query = "Select OldField1, OldField2, NewField1 from YourTable"

I already did that zrak. I guess I gone beyond the UI, to the extent that I made a modification the designer and resx files. My datagridview still captures my old structure of the table which I am targeting in my dataset. I saw when I browse its databindings - advanced property.

Really? did you able to fixed it? So far, It hasn't. I already did the ways that I know. My dataset is OK but when I'm going to use it as a source data of my datagridview, the old one still be captured. The updating method of the vb.net I guess is the problem. What will I do with this bug? even their community site has no solution for this.

Wow! you're great. I am using wizard when I bound my datagridview to my dataset so I cannot give a code. It's a autogenerated code. How did you fixed it? maybe I could get some idea or hint where to start repairing. :)

Public Sub DiffColHeader(ByVal dgvw As DataGridView)
        Try
                    SettingDatagrid(dgvw, 0, "NameofYourHeader 1", "Field1", 70)
                    SettingDatagrid(dgvwName, 1, "NameofYourHeader 2", "Field2", 200)
        Catch ex As Exception
            MsgBox(Err.Description, "Error")
        End Try
End Sub
Public Sub SettingDatagrid(ByVal dgvw As DataGridView, ByVal ColNum As Integer, ByVal DgvwHeader As String, ByVal DataField As String, ByVal ColWidth As Integer, Optional ByVal blnVisible As Boolean = True)
        Try
            With dgvw.Columns(ColNum)
                .HeaderText = DgvwHeader '--DataGridHeader
                .DataPropertyName = DataField '--Your Field Name
                .Width = ColWidth '--Width of your Column
                .Visible = blnVisible '--if you want your column to be visible set it to true
            End With
        Catch ex As Exception
            MsgBox(Err.Description, "Error")
        End Try
End Sub

hope it will help you...

Ah...I did same as yours. The only difference is the instance. I made it at design-time not run-time. It's a really a great help atleast you had shown to me that what I am doing isn't wrong because I was worried before maybe at program execution it may give a serious problem, I mean the data.

Thank you so much Blu/zrak.. :)

This article has been dead for over six months. Start a new discussion instead.