|
|
|
I have an application that communicates with the server program through a shared text file, located at a network directory. The server writes to the text file which my application reads. I am using FileSystemWatcher to monitor this file.
Now when server writes to the file, change event in my application fires after 2 or 3 seconds. However when I manually change this file and save it, it acts the ideal way. I want to reduce this time delay as this should act like realtime system.
My C# code goes like this :
-------------------------------------------------------------------
public MyWatcherClass()
{
watcher = new FileSystemWatcher();
this.watcher.Path = this.MyNetworkDrive;
this.watcher.NotifyFilter = NotifyFilters.Size;
this.watcher.Filter = this.MyTextFile;
this.watcher.Changed += new FileSystemEventHandler(OnChanged);
this.watcher.EnableRaisingEvents = true;
}
-------------------------------------------------------------------
What am I missing?
Thanks in advance
|
|
|
|
|
|
Off course I am already doing it. Didn't anyone else experince it?
|
|
|
|
|
I have to compare two XML files in C# by their attribute "name".Any ideas how can I realize that?Best regards
|
|
|
|
|
|
What about the Key feild of both xml file. both are same or what ?
Sreejith Nair
[ My Articles ]
|
|
|
|
|
I'm very new to C# and .NET and this is my very first project. I have a form that allows people to enter quantity of the item they order and then displays the description and quantity of the selected items. I'd like to capture the values from a list of textboxes and pass them to an array and have no idea how to start. Please help. Thanks
|
|
|
|
|
One way to do it is as follows:
<br />
using System.Collections;<br />
...<br />
<br />
private ArrayList MyArray = new ArrayList();<br />
private void button1_Click(object sender, System.EventArgs e)<br />
{<br />
MyArray.Add(this.textBox1.Text);<br />
}<br />
Radgar
"Imagination is more important than knowledge." - Albert Einstein
|
|
|
|
|
Yes, I've done that. The only problem is I have to pass multiple textboxes values. The textboxes were name as txtBox1, txtBox2 ... and so on. I guess I'm having problem with passing those names as variables. Any helps would be appreciated. Thanks
|
|
|
|
|
If you can provide some code, I can help you more. I don't think I really understand what you want to achieve. If you are using multiple textboxes you can do the following:
<br />
...<br />
MyArray.Add(this.txtBox1.Text);<br />
MyArray.Add(this.txtBox2.Text);<br />
MyArray.Add(this.txtBox3.Text);<br />
...<br />
or you may want to use multi-dimensional arrays... Just submit some code so I can help...
Radgar
"Imagination is more important than knowledge." - Albert Einstein
|
|
|
|
|
Thanks Radgar. I was able to load ALL the items to a datagrid. However, I only want to display only items that have values on the quantity boxes.
Here it is, with Merchandise is a class that loads the textboxes and hidden fields to the array.
---------------------------------------------------------------
private void Submit_Click(object sender, System.EventArgs e)
{
ArrayList ListItems = new ArrayList();
ListItems.Add(new Merchandise(txtQty1.Text, hdnDesc1.Value));
ListItems.Add(new Merchandise(txtQty2.Text, hdnDesc2.Value));
ListItems.Add(new Merchandise(txtQty3.Text, hdnDesc3.Value));
ListItems.Add(new Merchandise(txtQty4.Text, hdnDesc4.Value));
DataGrid1.DataSource = ListItems;
DataGrid1.DataBind();
}
---------------------------------------------------------------
I'm thinking of 2 dimentional array as well but still struggling on how to implement it since I'm very new at this. Thanks again Radgar
|
|
|
|
|
If I understood right, you don't need ArrayLists here. I think the following solution will solve your problem. Let me know if it does.
<br />
DataSet myDataSet = new DataSet("myDataSet");<br />
DataTable myTable = new DataTable("Merchandise");<br />
myTable.Columns.Add("Param1");<br />
myTable.Columns.Add("Param2");<br />
<br />
DataRow myRow;<br />
myRow = myTable.NewRow();<br />
myRow["Param1"] = "some value";<br />
myRow["Param2"] = "some other value";<br />
myTable.Rows.Add(myRow);<br />
myDataSet.Tables.Add(myTable);<br />
<br />
myTable.DefaultView.RowFilter = "Param1 <> ''";<br />
<br />
dataGrid1.SetDataBinding(myDataSet, "Merchandise");<br />
Radgar
"Imagination is more important than knowledge." - Albert Einstein
|
|
|
|
|
I used the ArrayLists and it worked. However, I used your logic for another form on the application and was successful. Thanks again for your help and patience Radgar.
|
|
|
|
|
Glad to hear that.
Radgar
"Imagination is more important than knowledge." - Albert Einstein
|
|
|
|
|
I am new to progamming world and just want to start with C#.
How can I write a simple program like
The program will ask u
what is your name?
You type:
Robert
and it say
Hi, Robert.
Thank so much.
|
|
|
|
|
The Console class has what you are looking for. Look for the ReadLine() and the WriteLine() methods.
Regards
Senthil
My Blog
|
|
|
|
|
Anonymous wrote:
The program will ask u
what is your name?
Console.WriteLine("what is your name?");
Anonymous wrote:
and it say
Hi, .....
Console.WriteLine("Hi, " + Console.ReadLine());
|
|
|
|
|
I want to save a great float type data array into a SQL server database. But I donot know how to convert a float array (float[]) to a byte array (byte[]) . Please help if anyone can solve this problem, thanks .
xu guoqing
|
|
|
|
|
The BitConverter class does the job. You can do somthing like
<br />
byte[] GetByteArray(float []f)<br />
{<br />
byte[] byteArray = new byte[f.Length * 4];
int index = 0;<br />
foreach(float floatVal in f)<br />
{<br />
byte []convertedBytes = BitConverter.GetBytes(f);<br />
byteArray[index++] = convertedBytes[0];<br />
byteArray[index++] = convertedBytes[1];<br />
byteArray[index++] = convertedBytes[2];<br />
byteArray[index++] = convertedBytes[3];<br />
}<br />
<br />
return byteArray;<br />
}<br />
Does this help?
Regards
Senthil
My Blog
|
|
|
|
|
How can get the codeDOM tree of a method at runtime? Something like this:
((CodeMemberMethod)RetrieveCode(someObject.GetType().GetMethod("MyMethod"))).Statements;
Greetings Harald
|
|
|
|
|
What you are trying to do is logically not possible, unless there is some intermediate file that maps IL to language statements. You see, once you compile the code, the source is gone, it may not even exist on the machine the code is being run. Even if it does, there is no association (except for map files) between the IL and the source.
Regards
Senthil
My Blog
|
|
|
|
|
Your Wrote :
see, once you compile the code, the source is gone,
Where ? Can you explain it little bit more ?
Sreejith Nair
[ My Articles ]
|
|
|
|
|
What the (@^^% do you mean 'where'? No-where! It's forgotten about! Once the source IL is compiled, it isn't needed anymore, so it gets dropped.
What do you think happens when you call .Clear() on a TextBox? Where does that data go?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|