0

I want some simple thing ,but I dont know how do this. When I click on dataGridView some row ,to one column I have some int value. I need to set value to trackbar. How I can do this?

This is the last code, what I tried

 trackBar1.Value = row.Cells["priority"].Value.ToString();c

Thank you!

eatmailyo
  • 670
  • 1
  • 12
  • 33
  • @Fred when I click on row data, all data what I have ,writes into textboxes ,but I want that last priority data value show at trackbar – eatmailyo Feb 13 '16 at 15:45
  • If you follow that link is shows you how to do that. Replace "you have to mention you cell corresponding column name" with "priority" if that's the name of the cell you are interested in. Check the value is numeric, convert it to an `int` ( `Convert.ToInt32(value)`) and assign the value to `trackBar1.Value` It could be you already have the value and are trying to assign a `string` to an `int` `trackBar1.Value = row.Cells["priority"].Value.ToString();` will never work `trackBar1.Value = Convert.ToInt32(row.Cells["priority"].Value);` might – Fred Feb 13 '16 at 15:52
  • @Fred put this comment on answer ,than I can match as answered! Thank you :) – eatmailyo Feb 13 '16 at 16:45

1 Answers1

1

This will show you the base of what you want but....

It could be you already have the value and are trying to assign a string to an int trackBar1.Value = row.Cells["priority"].Value.ToString(); will never work trackBar1.Value = Convert.ToInt32(row.Cells["priority"].Value); might

Community
  • 1
  • 1
Fred
  • 5,663
  • 4
  • 45
  • 74