|
-
Jul 30th, 2010, 12:29 PM
#1
Thread Starter
Fanatic Member
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!
-
Jul 30th, 2010, 03:30 PM
#2
Member
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 ?
-
Jul 30th, 2010, 05:25 PM
#3
Thread Starter
Fanatic Member
Re: DataGridView / Data Source (Adding new row programmatically) + Custom Control 'se
 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.
-
Jul 30th, 2010, 05:32 PM
#4
Hyperactive Member
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.
Last edited by dkahn; Jul 30th, 2010 at 05:44 PM.
-
Jul 30th, 2010, 06:36 PM
#5
Thread Starter
Fanatic Member
Re: DataGridView / Data Source (Adding new row programmatically) + Custom Control 'se
 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.
-
Jul 30th, 2010, 07:15 PM
#6
Hyperactive Member
Re: DataGridView / Data Source (Adding new row programmatically) + Custom Control 'se
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.
Last edited by dkahn; Jul 30th, 2010 at 07:34 PM.
-
Jul 30th, 2010, 08:13 PM
#7
Thread Starter
Fanatic Member
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
-
Jul 30th, 2010, 09:19 PM
#8
Hyperactive Member
Re: DataGridView / Data Source (Adding new row programmatically) + Custom Control 'se
How'd you fix solution #1?
-
Jul 31st, 2010, 12:26 AM
#9
Thread Starter
Fanatic Member
Re: DataGridView / Data Source (Adding new row programmatically) + Custom Control 'se
Code:
KeyTableAdapter.Fill(RegestrationDataSet.key)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|