|
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.
|
|
|
|
|
Well if that's the case I tried renaming the folder name once the file is selected from the OpenDialog and i clicked on OK button. right. If i were to rename MYMAINFOLDER at
if (filename != "")
{---------------------------->even here doesn't let me to rename
Open(filename);
}
I have spent 2 hours and this thing making me to pull out my hairs. only couple left
|
|
|
|
|
Hi,
you must be doing something special you didn't mention since normally renaming a folder works just fine. Here is test code that works as expected for me:
using (OpenFileDialog d=new OpenFileDialog()) {
if (d.ShowDialog()==DialogResult.OK) {
string f=d.FileName;
log("f="+f);
string f2=f+"a";
File.Move(f, f2);
log("File rename OK");
string dir=Path.GetDirectoryName(f2);
log("dir="+dir);
string dir2=dir+"a";
Directory.Move(dir, dir2);
log("Folder renamed to "+dir2);
}
}
I do have some remarks when looking at your code;
1.
your if(openDialog != null) {openDialog = null;} isn't very useful; first of all, if you want it to be null, just write openDialog = null; . However if openDialog doesn't interest you any more, once your using block is closed, keep the declaration inside the using (as I did).
2.
Calling Dispose() on the subject of a using block is not looking good. The using block is there to take care of it.
3.
Don't call GC.Collect(), the way it works automatically will do a better job if you don't interfere with it.
Now the problem you are having may be caused by something you did not tell us; here are two likely causes:
1.
you did open and not close one of the files inside the path you are trying to rename; e.g. maybe you do a myPictureBox.Image=Image.FromFile(aFileInsideTheChosenFolder);
2.
you did create, write and close a new file inside the folder; although you closed it, some other process may be busy reading the file (an anti-virus scanner, an automatic indexing program, whatever). Try inserting a Thread.Sleep(3000) before you attempt to rename.
Hope this helps.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|