|
-
May 19th, 2011, 05:57 PM
#1
Thread Starter
New Member
Datagridview to control picturebox width Help
Hi everyone, new to the forums here and I needed some hekp with a program I'm working on. Basically, I have a datagridview and I want to use values inputed into it to control the position and width of pictureboxes. When I use my code I get an index out of range error for any row other than the first one. When I have only the code for the first row it works, when I add more it doesnt.
Heres the code so far:
under form load:
DataGridView.Rows.Add(28)
under datagridview value changed event:
picBar1.Width = DataGridView.Item(3, 0).Value * 27
picBar1.Location = New Point(picCalendar31.Location.X + DataGridView.Item(2, 0).Value * 27 , picBar1.Location.Y)
picBar2.Width = DataGridView.Item(3, 1).Value * 27
picBar2.Location = New Point(picCalendar31.Location.X + DataGridView.Item(2, 1).Value * 27 , picBar2.Location.Y)
Any help is appreciated, thanks
-
May 19th, 2011, 06:00 PM
#2
Thread Starter
New Member
Re: Datagridview to control picturebox width Help
BTW it is an unbounded datagridview
-
May 20th, 2011, 12:05 AM
#3
Re: Datagridview to control picturebox width Help
Can we assume that you mean the CellValueChanged event? You should always use the actual names for things rather than approximations that require assumptions to be made. You'll avoid confusion that way.
If you're handling the CellValueChanged event then why aren't you using the ColumnIndex and/or RowIndex provided by the event? Also, you are using data from two different rows. How does that work? We need a full and clear description.
-
May 20th, 2011, 09:17 AM
#4
Thread Starter
New Member
Re: Datagridview to control picturebox width Help
Yes it is th CellValueChanged Event. And I am using different rows becuase I have multiple pictureboxes. The first row in the datagridview corresponds to the first picturebox, the second row to the second picturebox and so on.
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
|