|
yes in windows application only
u wil have item property check once again
Private Sub DataGrid1_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.CurrentCellChanged
TextBox2.Text = DataGrid1.Item(DataGrid1.CurrentCell.RowNumber, DataGrid1.CurrentCell.ColumnNumber)
End Sub
|
|
|
|
|
How can i use RowFilter Property of DataView in C#?
|
|
|
|
|
RowFilter is used when you want to display some but not all rows of datatable based on some criteria. This criteria is specified in RowFilter. It is similar to that of using WHERE clause in your SELECT query.
For more reference please visit:
http://davidhayden.com/blog/dave/archive/2006/02/11/2798.aspx[^]
Regards,
Ketan.
|
|
|
|
|
How can we notify the client that the task has been completed by the windows service
|
|
|
|
|
i want to insert elemet of a array of ArrayList in a DataGrid. but how.plz help me.
|
|
|
|
|
Hope this helps you;
ArrayList.Rows.Clear();
for(int _x=0;x<ArrayList.Count;x++)
{
DataRow _row = DataTable.NewRow();
_row["???"] = ArrayList[x];
DataTable.Rows.Add(_row);
}
All the best,
Martin
|
|
|
|
|
See this example:
ArrayList arrayList = new ArrayList();
arrayList.Add(1);
arrayList.Add(2);
arrayList.Add(3);
DataTable dataTable = new DataTable("Table1");
dataTable.Columns.Add(new DataColumn("Column1", typeof(int)));
foreach(int i in arrayList)
{
DataRow dataRow = dataTable.NewRow();
dataRow["Column1"] = i;
dataTable.Rows.Add(dataRow);
}
this.dataGrid1.DataSource = dataTable;
|
|
|
|
|
Hi,
I have a big solutions which includes many c# projects and c++ projects. Some c++ project use the dll files generated by the c# projects. Now I begin to migrate the whole solution to 64-bit platforms. After setting the project, I found all the c# projects in this solution can not generate the expected dlll files.
I am a little confused. Could you help me if you are familiar with this?
Thanks a lot.
-- modified at 1:44 Thursday 29th June, 2006
|
|
|
|
|
As far as I know, there is no 64 bit compiler for C# or C++.NET. But for C++ (unmanaged) you can use for example Intel C++ Compiler.
|
|
|
|
|
I'm currently working on a monitoring system for tank overflows. I am using C#.net on a windows CE. How can I read and write to IO ports on Windows CE? What dll should I use?
|
|
|
|
|
User SerialPort class that resides on
Namespace: System.IO.Ports
Assembly: System (in system.dll)
Hope this helps u
|
|
|
|
|
Hello,
Thanks for replying to my message. I can already read and write to serial port. My concern now is how to read and write to ports other that serial ports. Like if I want to write to an IO port with address (0x378) and I want to write the data 0xFF; something like that.
I tried to add to my project the following codes,...
[DllImport("inpout32.dll", EntryPoint = "Out32")]
internal static extern void Out32(short PortAddress, short data);
[DllImport("inpout32.dll", EntryPoint = "Inp32")]
internal static extern short Inp32(short PortAddress);
public void PortOut(short address, short data)
{
Out32(address, data);
}
public short PortIn(short address)
{
Inp32(address);
}
but it is not working, maybe I used the wrong dll. By the way I am using WindowsCE and VSC#.NET 2005 version.Can you give me any ideas or maybe sample codes on how to do this. Thanks
|
|
|
|
|
Hello,
I'm using ADO.NET & MS Access. I'd like to know how can I determine if the datasource is writable. I mean what if the user if running the application from a CD and I try to update a row? Is there a special exception thrown or something?
.NET Framework version: 2.0
Please advise. Thanks.
|
|
|
|
|
If you attempt an update when the file isn't writable, it'll throw an OleDbException with the message "Operation must be an updatable query."
|
|
|
|
|
Thanks but is it possible to know in advance?
|
|
|
|
|
You might want to double check this before you waste your time. It may not even be possible to open an Access database unless the media it's on is writable. Easy enough to test...copy a small database to a floppy, lock it, then write a little code to read from the database on the disk.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I just lost a brand new DVD because of you
It worked normally on 2 machines.
Base on what you thought it won't work?
|
|
|
|
|
Dave was right in suspecting it may not work.
Access needs to create a temporary ldb file whenever it is being opened, and therefore needs to have write permission to the folder where the mdb file resides.
Try this by restricting write access to a folder where your .mdb file resides and you'll have a permission exception.
"Democracy is two wolves and a sheep voting on what to have for dinner" - Ross
Edbert
Sydney, Australia
|
|
|
|
|
I really wrote my exe file and the database to a DVD and it worked without any problem.
Maybe the ldb temporary file is not required?
Please advise.
|
|
|
|
|
AngryC wrote: Maybe the ldb temporary file is not required?
I think this is correct. It is normally used to handle multi user access. If its not there (for example because of readonly media) it *may* be possible that multi user access is somehow unsafe.
|
|
|
|
|
I said floppy!! You could have used a CD too, they're at least a little cheaper!
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I have found a condition where my dialog does not stay modal. I'm using the following snipit of code to create my modal dialog...
public void ShowMyDialogBox()
{
MessageForm testDialog = new MessageForm();
// Show testDialog as a modal dialog and determine if DialogResult = OK.
if (testDialog.ShowDialog(this) != DialogResult.OK)
{
Console.WriteLine("ERROR Broke Modal DialogBox\n");
}
testDialog.Dispose();
}
This method is called when my serial communications callback function gets called. When the message dialog is displayed, I can still click on the parent form to move it around, or perform button click actions.
The only thing I can think of at this point is it might be a threading issue, where the callback is running in a different thread than the main thread.
Can anyone help me?
McSmack
-- modified at 20:59 Wednesday 28th June, 2006
|
|
|
|
|
McSmack,
I would agree with your assessment, that it is a threading issue where the callback is running in a different thread than the main thread. This would cause the two dialogs to act as you mention. Here is a way to test that to see if it is the case, and also a way to fix it if it is.
First, to test if they are running on different threads
1) Add the following line of code to the constructor of your main parent form:
System.Threading.Thread.CurrentThread.Name = "Main Thread"; This will give a name to the main thread so that we can identify it and distinguish it from another thread.
2) Now, inside the dialog which you want to show (the MessageForm dialog), add this line to your function ShowMyDialogBox :
System.Diagnostics.Trace.WriteLine("Thread is named: " + System.Threading.Thread.CurrentThread.Name); This will write a line to the trace output which gives you the name of the thread which is calling ShowDialog on your second form.
Now, look at the trace output (one way is to run the program in debug mode and then look at the output in Visual Studio) and see if you see "Thread is named: Main Thread" when your ShowMyDialogBox function is called. If it is, then the dialog is being displayed on the main thread after all and something else is wrong. If it is not the same thread, then you will see something like "Thread is name: " - just blank, because the thread is unnamed.
Second, marshaling back to the main thread
If the issue is indeed that the second dialog is displayed on a different thread, here is the way you can fix your ShowMyDialogBox function so that you can marshal back to the main thread:
public void ShowMyDialogBox()
{
if(this.InvokeRequired)
{
this.BeginInvoke(new MethodInvoker(this.ShowMyDialogBox));
return;
}
...
} Basically what this is doing is checking (via InvokeRequired ) whether the thread which is executing the ShowMyDialogBox function is the same thread which created the main form. If it is not, then InvokeRequired will be true, and the function BeginInvoke will post a message which the main thread will receive. The BeginInvoke will cause the main thread to execute the code contained in the method ShowMyDialogBox . Thus, when the main thread is executed the function, InvokeRequired will be false, and the rest of the code will execute as normal, with your second dialog box completely modal.
Let me know if anything in this is unclear or if you are still having problems. I don't pretend to be an expert at this, althought I have dealt with the same kind of problem you are having.
Sincerely,
Alexander Wiseman
|
|
|
|
|
Hello Alexander,
Is it also possible to Invoke a Method with Parameters? ShowMyDialogBox(bool btest, ....)
I had some problems compiling this.
Just for Info.
Thanks for your time,
Martin
-- modified at 1:35 Thursday 29th June, 2006
|
|
|
|
|
Martin,
You won't be able to invoke a method with parameters if you are using the MethodInvoker delegate. Here is what MSDN says about MethodInvoker :
"MethodInvoker provides a simple delegate that is used to invoke a method with a void parameter list. This delegate can be used when making calls to a control's invoke method, or when you need a simple delegate but don't want to define one yourself."
Since MethodInvoker has a void parameter list, and since the function you specify must have the same parameters as the delegate in question, you won't be able to invoke a method with parameters using it.
In order to do this, you need to define your own delegate, which has the correct argument list. Let's suppose that the function you want to invoke by BeginInvoke has two parameters, a bool and a String , and that it looks like this:
public void ShowMyDialogBox(bool bTest, String message) Now, you would define your delegate like this:
public delegate void MyDelegate(bool bTest, String message) The name of the delegate is completely optional, as are the names of the parameters. We could have called the boolean parameter anything we want (e.g. bBoolParam ) and we could have called the string parameter anything we want. Now we would invoke this as follows:
BeginInvoke(new MyDelegate(ShowMyDialogBox), new object [] { varToBeParam1, varToBeParam2 }); So now, if we put that together, our ShowMyDialogBox function would look something like this (assuming the scenario which McSmack had laid out):
public void ShowMyDialogBox(bool bTest, String message)
{
if(this.InvokeRequired)
{
this.BeginInvoke(new this.MyDelegate(this.ShowMyDialogBox), new object [] { bTest, message });
return;
}
...
} Hope that helps! Feel free to respond if you have any more questions about this, or if you do not understand something in the answer.
Sincerely,
Alexander Wiseman
|
|
|
|