|
|
i think using lock may not work in his case
because when using lock you actutually using Monitor
which Prevents more than one thread at a time from accessing a file but it have not ability to span application and process boundaries
|
|
|
|
|
I have an issue in my project. I am dowloading a webpage and reading line by line of the site.
The output I get is the full webpage displaying the information on the site and also the tags.
Is there any possibilities to write some code to ignore the tags so that only the interesting bits of the page will be displayed?
I am using the .NET compact framework and need this in C#.
Anyone have a clue?
Ninety-eight percent of the thrill comes from knowing that the thing you designed works, and works almost the way you expected it would. If that happens, part of you is in that machine.
|
|
|
|
|
you need to parse the page source and extract the info you want
|
|
|
|
|
One way of efficiently extracting data like that from a string is to use a regular expression. Have a look att the RegEx class.
You say that you read line by line? The html page is not line oriented at all, so there is no reason to read it line by line. Read it all into a string, then extract what you want from that string.
---
b { font-weight: normal; }
|
|
|
|
|
How to loop through the Hash Table.I get the collection of keys in hashtable and loop through that but its not working.Help me.
Regards.
S.Sevugan
|
|
|
|
|
How to loop through the Hash Table.I get the collection of keys in hashtable and loop through that but its not working.Help me.
Regards.
S.Sevugan
|
|
|
|
|
Hashtable hashTable = new Hashtable();
hashTable.Add("1", "AAA");
hashTable.Add("2", "BBB");
hashTable.Add("3", "CCC");
IDictionaryEnumerator hashEnum = hashTable.GetEnumerator();
while ( hashEnum.MoveNext())
{
Console.WriteLine(hashEnum.Key.ToString() + ":" + hashEnum.Value.ToString());
}
Live Life King Size
Alomgir Miah
|
|
|
|
|
A simple foreach over the Keys property should do the job
foreach(object obj in hashtable.Keys)
{
...
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Agreed.
Live Life King Size
Alomgir Miah
|
|
|
|
|
Or even simpler, over the Values, if those are what you're interested in.
Matt Gerrans
|
|
|
|
|
Or, even more complete, use
foreach (DictionaryEntry ent in myHashtable)
{
...
} where you immediately get each key-value-pair...
Regards,
mav
|
|
|
|
|
I'm using crystal reports to view data in an access database. The problem I am having is that the report is not releasing the access database.The lock file is still there when I close the Form that the Report is in. I have to close the program and restart to release the database.
I have tried the "Dispose" method when closing the form. That seemed to work for a while but I eventually had to close the program again because the database was not being released.
Are there any suggestions? I would like to close the Report's connection to the database everytime that I close the Report's form.
|
|
|
|
|
I am presently trying to use just the UNC patch to the location of the batch.exe file that is located on a server. The example I am attempting is here below.
Process p = null;
p = new Process();
string targetDir;
targetDir = string.Format(@"\\servername\sharename\foldername\parentfolder");
p.StartInfo.WorkingDirectory = targetDir;
p.StartInfo.FileName = "Scan.bat";
p.StartInfo.Arguments = string.Format("Batch File Console");
p.StartInfo.CreateNoWindow = false;
p.Start();
p.WaitForExit();
Form1 f = new Form1();
MessageBox.Show ("Selected script has been Completed");
this.Close();
Is there a way to use a UNC patch without having a drive letter mapped to this share.
Thanks tstang
|
|
|
|
|
Hi,
Just from my experience with rolling out patches over a network I have found that there is no way to use UNC paths within a batch file. MS-DOS doesn't handle them nicely... the only way I could get around this was to add another couple of lines to the start of the batch file that mapped the dir to a driver letter:
net use z: \\PATH_TO_HOST\...<br />
cd z:\<br />
EXEC batchfile.bat
Hope that helps.
|
|
|
|
|
Has anyone been working with the VS 2005 Beta? I've been trying to deploy to my mobile device but it says I need an updated version of Active Sync. I already have 3.8 - is there a newer Beta version I can use?
|
|
|
|
|
Hi,
A programmer who used to work in my position created an application in ASP.net & c# (web application) to print a label in zebra printer Ht-146. I am so new to this kind of application and not sure how he did that. I think he used EPL2 programming language to print it. Right now the printer company zebra has discontinued this printer and I am not sure where to get help from. I don't have their programmer's manual to learn the EPL2language. My question is, is there any way that i could preview the label before printing it. Below is the code to print the label:
public int printlabel(string field1, string field2){
StringBuilder sb = new StringBuilder(2500);
//O-Hardware oprions. O- Disable all the options
sb.Append("O" + Environment.NewLine);
//Q-will cause the printer to recalculate and reformat the image buffer.
sb.Append("Q1014,1" + Environment.NewLine);
//q-set label width.
sb.Append("q608" + Environment.NewLine);
//S-selects the speed of the printer
sb.Append("S3" + Environment.NewLine);
//D-Print density
sb.Append("D5" + Environment.NewLine);
//Z-Print orientation T-Prining from top of image buffer
sb.Append("ZT" + Environment.NewLine);
//JF-Top of the form back up feature
sb.Append("JF" + Environment.NewLine);
sb.Append(Environment.NewLine);
//N-Clears the image buffer prior to building a new label image
sb.Append("N" + Environment.NewLine);
//LE-Line draw exclusive
sb.Append("LE305,2,1,1013" + Environment.NewLine);
//X-Draws a box shape P1-Horizontal start position P2-Vertical start position P3-Line thickness
//P4-Horizontal end position P5-Vertical end position
sb.Append("X305,507,1,458,1016" + Environment.NewLine);
sb.Append(Environment.NewLine);
sb.Append("X305,0,1,458,509" + Environment.NewLine);
sb.Append(Environment.NewLine);
//A -Command(ASCII), P1-Horizontal start position P2-Vertical Start Position P3-Rotation (3-270 degrees)
//P4 - Font Selection P5- Horizontal multiplier P6 - Vertical multiplier N-Normal or R-Reverse image.
sb.Append("A10,1009,3,3,1,1,N,\"PART NO. AND ITEM DESCRIPTION\"" + Environment.NewLine);
//LE-Line Draw Exclusive P1-Horizontal start position P2-Vertical start posiion P3-Horizontal length in dots
//P4-P4-Vertical length in dots
sb.Append("LE83,38,1,508" + Environment.NewLine);
sb.Append("LE83,38,1,508" + Environment.NewLine);
sb.Append("A109,1010,3,3,1,1,N,\"PN: " + field1 + "\"" + Environment.NewLine);
sb.Append("A133,1010,3,3,1,1,N,\"\"" + Environment.NewLine);
sb.Append("A157,1010,3,3,1,1,N,\"\"" + Environment.NewLine);
sb.Append("A181,1010,3,3,1,1,N,\"" + field2 + "\"" + Environment.NewLine);
sb.Append("A205,1010,3,3,1,1,N,\"\"" + Environment.NewLine);
printString = sb.ToString();
sendBytes = Encoding.ASCII.GetBytes(printString);
strlength = printString.Length;
try
{
TcpClient printer = new TcpClient(ip,portno);
NetworkStream strm = printer.GetStream();
strm.Write(sendBytes, 0, strlength);
strm.Close();
printer.Close();
}
catch (Exception exc)
{
return -1;
}
return 1;
}
Can anyone explain me whether there is any way to preview this label before printing it?
Is it possible for me to preview the label just by installing the print driver without the printer itself?
I would really appreciate your help.
NOTE: We have Bar-one software to create the label but not sure how to do that.
Thanks
|
|
|
|
|
i have one document which describes the PCL of zebra printers, let me know your mail id, so that i can mail that to you.
Ninety-eight percent of the thrill comes from knowing that the thing you designed works, and works almost the way you expected it would. If that happens, part of you is in that machine.
|
|
|
|
|
my email id is saruchamy@csc.com
I would really appreciate if you could email me that document.
Thanks.
|
|
|
|
|
Hi,
I have 3 questions.
1: How to Get sql numeric datatype in C#.Net
Exp:
dr.GetInt32(); // What will here
2:I have a combox which bind with a default View Manager and i set properties of combox like this:
adpclientinfo.Fill(dsclientinfo);
this.dviewmgrclient = dsclientinfo.DefaultViewManager;
this.cbclientname.DataSource = this.dviewmgrclient;
this.cbclientname.DisplayMember = "Client_Info.Client_Name";
this.cbclientname.ValueMember = "Client_Info.Client_Name";
this.txtclientcode.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dviewmgrclient, "Client_Info.Client_Id"));
Now i get value from db table and i want to select(mean select index or any other) same value from combox.
I use this.cbclientname.selectedValue = dr.GetString(0); //Client Name
<b>Muhammad Waqas Butt
waqasb4all@yahoo.com</b>
|
|
|
|
|
(1) dr.GetInt32(index);
or Convert.Int32(dr.GetValue(index));
index being the index of the column in a particular record.
(2) this.cbclientname.selectedValue = dr.GetString(0); //Client Name
wont work. You will have to assign the actual object from the list.
The workaround is to set the text property.
this.cbclientname.Text = dr.GetString(0);
The combobox will automatically try to find a match from the datasource and if a
match is found SelectedIndex changes automatically.
Live Life King Size
Alomgir Miah
|
|
|
|
|
Thanks for help but i didn't understand the answer of my second question:
==============================================
2) this.cbclientname.selectedValue = dr.GetString(0); //Client Name
wont work. You will have to assign the actual object from the list.
The workaround is to set the text property.
this.cbclientname.Text = dr.GetString(0);
The combobox will automatically try to find a match from the datasource and if a
match is found SelectedIndex changes automatically.
========================================
I get Value from GetString(0) is SK Technology and in combox it exits in second index i want to select SK Technology. which property of combox work.
1: SelectedItem
2: SelectedText
3: SelectedValue
Muhammad Waqas Butt
|
|
|
|
|
You should just set the Text property.
Setting the SelectedItem to work you must set the value to an actual object(not just text) from the source list.
Live Life King Size
Alomgir Miah
|
|
|
|