473,386 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

C#App: Problem in DataGridView CellclickEvent

40
hi
everybody
pls help me to solve my problem. Though my code is right (i feel) i couldnt achieve the result i expect , i tried in all means, any one pls solve my headache!.

Expand|Select|Wrap|Line Numbers
  1. private void DataGrdVw1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
  2.              {
  3.                  string CurrentSelValue;
  4.                  CurrentSelValue = DataGrdVw1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
  5.                  txtAreaName.Text = CurrentSelValue;
  6.              }
  7.  
it doent works!.

i tried with cell mouse down event also no use.

Expand|Select|Wrap|Line Numbers
  1.  private void DataGrdVw1_CellMouseDown(object sender,DataGridViewCellMouseEventArgs e)
  2.     {
  3.  
  4.  
  5.         this.GrdText.Text = DataGrdVw1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();//.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
  6.     }
  7.  
i need to show the current cell s text in a text box when the datagridview's cell is clicked with mouse, or arrow keys

pls help
kssk
Dec 21 '07 #1
2 1108
kenobewan
4,871 Expert 4TB
Please repeat after me - "I made an error". When things go wrong assume it is you fault first. What is the error message you received?

"I have failed over and over again, that is why I succeed." - Michael Jordan.
Dec 21 '07 #2
Plater
7,872 Expert 4TB
Funny.

Expand|Select|Wrap|Line Numbers
  1. private void DataGrdVw1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
  2. {
  3.    string CurrentSelValue;
  4.    CurrentSelValue = DataGrdVw1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
  5.    txtAreaName.Text = CurrentSelValue;
  6. }
  7.  
worked perfectly for me.

What did it do for you?
Dec 21 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Mike | last post by:
Hi, I am building a windows app. I have two threads that continually run in the background pulling information from a website. The data I extract from the two separate threads needs to be put...
7
by: Mitchell S. Honnert | last post by:
Is there an equivalent of the DataGrid's DataGridTableStyle for the DataGridView? If not, is there an easy way to duplicate the DataGridTableStyle's functionality for the DataGridView? Here's...
6
by: David Veeneman | last post by:
I am looking for a resource to learn how to do multithreading in a data bound app. So far, I have figured out that I can't update a databound object on a worker thread, because that triggers a...
7
by: vbbush | last post by:
In VB 2005, I am trying to reset a datagridview to its original state (as in..completely filled with all data). When the form loads, the datagridview is completely filled, however, after using a...
1
by: weird0 | last post by:
I am assigning an arrlist to the datasource property of the datagridview. In short, i want to update the datagridview. But the moment, i assign it. The application crashes. It does not display the...
1
by: slikrik98 | last post by:
Greetings, I believe I have narrowed down my issues to one simple question, and I'm hoping someone with async events experience can help me out. My question is: how is using...
1
nev
by: nev | last post by:
Happy Easter to all! I have a problem with a datagridview. I placed code in a button click event as follows: dim dtt as datatable = dataset.employees.copy dtt.DefaultView.RowFilter = "='" &...
3
by: Andrus | last post by:
I have DataGridView in virtual mode containing 3500 rows. In code below, assigning to RowCount value to 3500 takes 8 seconds. CPU usage goes high at this time. Stepping by F11 into user code shows...
3
by: Gun Slinger | last post by:
Hi guys, Just a quick question which i am fairly stumped with. I have had a look around, but it seems to be so simple there hasn't been many problems with it from other people. My issue is that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.