DataGridView / Data Source (Adding new row programmatically) + Custom Control 'settin
This is a 2 part thread, and any help would be most welcome.
1. I have a DataGridView box, that is connected to a MySQL database via the 'Data Source'. I am trying to do the datagridview1.rows.add("info here"), however i receive an error i cannot do this programmatically. I DO know the code to post to MySQL via the "insert into" la la la. However, I was curious if I can do this via the datagridview a bit..easier/simpler, such as a "datagridview1.rows.add(stuff)" sorta thing.
2. I am attempting to make a custom control, and as with ANY control, they have their.. settings. Example, a textbox, or label, has so you can set the Text. and color, etc.
Others, have it (such as datagridview) have the little icon on the control itself, where you click it, and it opens a small window with settings.
How would I do either of those for a setting of my control?
Thanks!
Re: DataGridView / Data Source (Adding new row programmatically) + Custom Control 'se
2.)
Private WithEvents Button as CommandButton
Private sub Form_Load()
Set Button=Form1.Controls.Add("VB.CommandButton","Dynamic")
Button.Visible=True
Button.Caption="Dynamic"
End Sub
Is that help ?
Re: DataGridView / Data Source (Adding new row programmatically) + Custom Control 'se
Quote:
Originally Posted by
cyberM
2.)
Private WithEvents Button as CommandButton
Private sub Form_Load()
Set Button=Form1.Controls.Add("VB.CommandButton","Dynamic")
Button.Visible=True
Button.Caption="Dynamic"
End Sub
Is that help ?
I will try it, thanks in advance though.
Re: DataGridView / Data Source (Adding new row programmatically) + Custom Control 'se
I haven't used MySQL, but when you bind a DataGridView to a DataSource, rows in the DataGridView are automatically added when you add rows to your DataSource. I'm not sure why you would want to manually add rows to just the DataGridView.
Re: DataGridView / Data Source (Adding new row programmatically) + Custom Control 'se
Quote:
Originally Posted by
dkahn
I haven't used MySQL, but when you bind a DataGridView to a DataSource, rows in the DataGridView are automatically added when you add rows to your DataSource. I'm not sure why you would want to manually add rows to just the DataGridView.
I'm looking to add rows to the database.
I am under the assumption that, since the datagridview1 is data bound to a database, when you add to 1, it updates the other.
Re: DataGridView / Data Source (Adding new row programmatically) + Custom Control 'se
Quote:
I am under the assumption that, since the datagridview1 is data bound to a database, when you add to 1, it updates the other.
I'm almost positive that it doesn't work like that. Maybe someone else will way in and be the deciding vote. :)
Re: DataGridView / Data Source (Adding new row programmatically) + Custom Control 'se
I fixed solution #1.
Now, onto Problem 2. CyberM, unfortunately, that is not what I want.
I am needing to save a variable, or a setting for a CONTROL that I am making. Not on a form.
Thanks :)
Re: DataGridView / Data Source (Adding new row programmatically) + Custom Control 'se
How'd you fix solution #1?
Re: DataGridView / Data Source (Adding new row programmatically) + Custom Control 'se
Code:
KeyTableAdapter.Fill(RegestrationDataSet.key)