In the event that fires when selecting a cell (cant remember the name), which should have parameter such as e.RowIndex and e.ColumnIndex, assuming your DataGridView is named myDGV:
myDGV.Rows[e.RowIndex].Cells[e.ColumnIndex].value.toString() -> this get the value of the selected cell.
myDGV.Rows[e.RowIndex].Cells["MyColumnName"].value = "MyStringValue" -> this sets a value for the specified cell.
I am trying to call a C++ function into C# using PInvoke. The C++ function accepts a filename as a parameter and then writes to that file.
However, the hitch is when a simple filename is passed from C#, at the C++ end it is implicitly appended with Escape characters which is why it cannot find the file.
For Eg: If I pass a file as "ABC.txt" which lies in my bin\debug folder of the C# application, at the C++ end it becomes bin\\debug\\abc.txt which is wht it cannot write to the file.
Did anyone encounter a similar problem and has resolved it?
Kinldy help me out here.
Any help is appreciated.
Are you sure that's not just the debugger representing the string as a C# string?
Have you viewed the string using the text visualiser instead to be absolutely sure it is really containing the double slashes? (Hover over the string variable, you'll get a little arrow in the tooltip which will offer you some visualisers, choose the Text Visualiser)
May be I was not very precise. In C#, I have to use '\' as an escape character. Hence If I pass a filename as "D:\\ABC.txt", the function in C++ does not take the path as is, it implcitly appends two more '\'s as escape characters (one for each '\' in the filename) and hence cannot
find the file.
I have a simple question.
With an interface I can force the classes that implements it, to implement methods and properties defined in the interface. But am I able to force the classes to inherit som other class, with an interface?
What you could do is make the class "inherit" the interface and then you inherit the class. If it is an abstract class I would imagine (because I've not tried it) that you could delay the implementation of the interface until it got to the class that inherits the abstract class.
Using an interface, you can only "force" a class to inherit only other interfaces.
If you want to force a class to inherit some other class, you can create, as others have said, an abstract class thats derives from the class you want to force inheritance. Keep in mind, though, that in c#, unlike interfaces, a class cannot directly inherit from multiple classe.
Without knowing anything other then your method names, did you include your access database file with your project? Did you hardcode the path to your access file, if so is that path still valid under vista?
I am using Mysql as my database.
i insert the date in the format DateTime.Now.ToString("dd/MM/yyyy") but the strange thing is its gets entered in dd-MM-yyyy format.
EVen if i manaually entered the date in database in dd/MM/yyyy and retrive the value from database , its get the format as dd-MM-yyyy.
where is the prob???
There is no problem. Databases don't store the date in a specific format - Don't know about MySql, but SQL Server and Sybase store it as a number, its up to your code to display it how you want. There will be a default format from the database (usually defined at server level) and its up to you to format it how you want.
Bob Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
Thks for ur reply, but it didn't solved my prob.
Interesting thing is date format dd/MM/yyyy in getting inserted correctly on my PC.
but when i deployed at client location its gets entered as dd-MM-yyyy format
coloum Type is varchar 50.
i search google for Open Source DotNet Based Desktop Sharing apps but did not find anything like that so please if anyone knows that there is such open source dotnet based Desktop Sharing apps then please inform me.....i will be highly obliged.
Last Visit: 31-Dec-99 18:00 Last Update: 22-Jun-21 17:40