|
hello my friends. Here is my question
I have a form and a table from a database, I show the datas of the table in the from as a datagridview, you know. so i wannt to click a cell and then a messagebox should appear which shows the data from the cell i have just clicked.
this is what i wrote
(producer is the name of the table)
string id = producerDataGridView.CurrentCell.Value.ToString();
MessageBox.Show(id);
it works but it is only shows some cells. for example i click three cells and it shows one of them or two,
is it a bug of visual studio 2008 or did i do something wrong wih the code?
thank you in advance
|
|
|
|
|
Ooops - this is not the ASP.NET forum. Sorry about that.
I suspect the issue is that your events are getting lost, because you show each one individually. What event are you catching ?
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
modified on Tuesday, May 19, 2009 7:54 PM
|
|
|
|
|
you are not helping by playing smart my friend. i do a project by using wisal studio 2008 c#. and this option is avaible, so it can be used somehow.I use datasets so the datas are saving in a datatable and i can use this datatable to obtain the datas.Can anyone else help me please?
|
|
|
|
|
private void producerDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
string id = producerDataGridView.CurrentCell.Value.ToString();
MessageBox.Show(id);
}
this is the code of the datagridview
how can it lost? i stored them in the datatable... and why sometimes is shows the datas and others it doesnt?
|
|
|
|
|
i would change the event to cellclick instead of cellcontentclick.
I would then interrogate e to identify the cell clicked rather than getting the currentcell.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
i am not sure that i am following you, i am newby, i just doubleclicked the datagridview and the code appeared, if i change the code i cant save tha data in a stirng, can you show me a little code, someone?
sorry for being to pressure
|
|
|
|
|
This tells me you are using the cellcontentclick event. there is a similar event called CellClick that may serve you better
private void producerDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
string id = producerDataGridView.CurrentCell.Value.ToString();
MessageBox.Show(id);
}
Investigate the DataGridViewCellEventArgs e or sender. sender will be the cell that was clicked
You are using and event and then ignoring the content of the event and checking producerDataGridView.CurrentCell.Value.ToString();
Now the currentcell SHOULD be the cell you clicked but oh wait you trapped the CELLCONTENT event, is this guaranteed to point to the currentcell.
So basically you are peering into a bowl of spagetti and hoping you get the 2 end of the same strand. Use the correct event (this can be difficult to identify) and use the event to identify the cell
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
For certain reasons I have:
a) a server supporting ASP.NET but with VERY minimal monthly bandwidth,
b) a server with no ASP.NET support, but with lots of monthly bandwidth.
Now im trying to figure out the best way to get around having the users uploaded images/videos/files on one server and just hosting the code/db on the other.
I thought about the following:
The user loads the asp page and uploads what they want, this goes onto server A(look above), then server A's code transfers the file to server B via ftp and the link is stored in db which will be read when the user needs the file and directed.
Two problems with that though, 1) Isnt ftp hellishly slow and outdated? 2) Lets say the file was 10mb. It would be uploaded to server A(10mb), then server A would upload it to B(10mb+10mb), then server B would have it(10mb+10mb+10mb). So it would end it 30mb transfer.
I would be very greatfull if someone could give me some ideas about the best way to achieve this.
|
|
|
|
|
What about host the static content in amazon s3 or such
|
|
|
|
|
As I said I have hosting and for various reasons I have to use that.
|
|
|
|
|
I have a a windows application which works great written in C#, and I was wondering what are the steps to take to convert it to a mobile device application? Is the process just a copy and paste process? Or is there more to it?
It would be helpful if you tell me what the difference between the two?
Thanks in advance.
|
|
|
|
|
Star09 wrote: Is the process just a copy and paste process?
Yes
|
|
|
|
|
Just tried it, groupbbox can't be used among many other controls. Is there something I'm missing?
|
|
|
|
|
Star09 wrote: Is there something I'm missing?
No
|
|
|
|
|
A mobile device usually doesn't have XP/Vista/Weven installed. That means that some functionality that's present on your PC won't be present in your mobile.
Start your mobile adventure here[^]
I are troll
|
|
|
|
|
The framework is different - although very similar in many respects.
You will need to research to see what controls are not there / behave differently, and the same for any other inbuilt classes you're using, and redesign accordingly.
Mostly, it's stuff taken out, but there are additions too. Most of the stuff that's not there can be recreated easily enough with some 'googling' and some API calls.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Scenario:
I have a few sub-folders and files in a folder named MYMAINFOLDER.
I read all those sub-folders and files and load them in a form, but if i want to change the MYMAINFOLDER name through windows explorer I got an exception saying that files are being used.
Thing I have tried out:
1). I get no exception if I were to change the subfolder and files names through windows exploere.But as soon as i try to rename the MYMAINFOLDER i get exceptions.
|
|
|
|
|
I guess you can't rename the folder cause it's locked for use. Maybe you are running an executable that resides in the folder, or something similar.
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
Your app, or something else, has files that are still open in that folder.
In order to change the name of the folder, ALL of the files in that folder, and any subfolders must be closed.
|
|
|
|
|
Thanks for answering guys, but here are few more detailed I found out and never knew.
I drilled down to the lowest level while debuggin my apps and found something very interesting point. At Line 5 execution if i were to go rename the foldername through windows explorer no problem but as soon as i were to come in line 7 and then go back on windows exploere to rename the folder then i get the exception.
Could gurus enlightend me with their suggestions.
1) string filename = "";
2) OpenFileDialog openDialog = null;
3) using (openDialog = new OpenFileDialog())
4) {
5) openDialog.InitialDirectory = TempFolderpath ; ---> No problem
6)
7) if (openDialog.ShowDialog(this) == DialogResult.OK)-----> Problem.....
8) {
9) filename = openDialog.FileName;
10) openDialog.Dispose();
11) GC.Collect();
12) }
13)
14)
15) if(openDialog != null)
16) {
17) penDialog = null;
18) }
Folder Structure
----TempFolder
|
|____MYMAINFOLDER
|
|__Folder1
|__Folder2
|__File1.xml
|__File2.html
modified on Tuesday, May 19, 2009 4:55 PM
|
|
|
|
|
At line 7 you create an open file dialog which starts in the folder contained in TempFolderpath. If that's your MYMAINFOLDER folder, then it gets locked and that's why you cannot rename it.
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
That's not the case that's y i had shown my folder structure. At this point i am not sure where the where folder gets locked. Do you think the place where i pointed out that's causing the problem or there may be somewhere something else i need to focus on.
I don't even start to read the files but as soon as the File1.xml is selected through the OpenDialog then the MYMAINFOLDER gets locked. I don't think, it should behave like this becuase i didn't even start reading the files yet. u know what i mean.
Folder Structure
----TempFolder
|
|____MYMAINFOLDER
|
|__Folder1
|__Folder2
|__File1.xml
|__File2.html
|
|
|
|
|
As soon as you select the file, you have an intention of using it or doing something to/with it. It's a good idea to prevent the possibility that someone moves the things that you intend to use.
Swap the "file" idea with a "chair". Now, what Windows' does is preventing that someone moves your chair if it looks like you want to sit on it
I are troll
|
|
|
|
|
My bad, I misread the folders structure. But still, my point remains. You are pointing at the folder with your dialog, so you can't rename it.
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
The OpenFileDialog is using whatever path it's showing as the "Current Directory", and locks this path while the dialog is active. You can't rename any folder along this path until the dialog is dismissed.
You'll also see this issue if there is a command prompt open. If it's, say, sitting in the path C:\TopFolder\SubFolder\SubFolder2, you can't rename or delete any folder in that path.
Also, do NOT call GC.Collect. You'll just end up screwing up the GC's internal self-tuning algorithm.
|
|
|
|