|
Ha-ha, you have a very good sense of humor. It makes it more fun and adds to my dull and busy day. You are correct sir. You did have that. I am looking through Form 2 and I see I need to add something else to get this to work. One down and one to go. I will follow up with you tomorrow. Thanks again Henry and have a good night!
|
|
|
|
|
Hi Henry,
I was extremely busy yesterday but I was able to work on this demo for about an hour. As it turns out I am having difficulties getting the second form to work. I looked through the code again and saw that I was missing a combobox so I added that to the dgv; however this didn't fix the issue. Can you send the designer code for the second form when you get a chance please?
Thank you,
Brenton
|
|
|
|
|
Hi Henry,
Thank you for sending me the demo. Even though I was not able to get it to work, I was able to get my app working by dissecting the code you wrote. I'm sorry I caused you frustration and thank you again for helping me on this. I will close this out now and give you the rating you deserve.
Thanks again,
Brenton
|
|
|
|
|
Hello.
I have a application with a webclient. In that webclient I am loading a homepage with about 5 frames, but one of the frames are refreshing constantly each 30second.
That gives me problem when I want to use the source from another frame - because when I use IsBusy and it is refreshing the frame with constantly refreshing while I am navigating another frame, does the application think that frame is done navigating too, and then I of course get an error.
It happens very often, and stops the whole program.
So is there any way only to check one frame if it is done loading ?
Hope your guys can help me out.
|
|
|
|
|
hello,
i am using the WebBrowser Navigate to navigate to a webpage from my c# application.
i try to post data to a form which is in that page. (its my page , i control it)
first , what is the name of the field i need to put in the post string?
is it ID or NAME ?
second , i tried various methods but none filled the form textbox with the information i sent. what am i doing wrong?
here's the c# code
WebBrowser Web = new WebBrowser();
string postdata = "ctl00_pass=1234";
System.Text.Encoding a = System.Text.Encoding.UTF8;
byte[] SendBytes = a.GetBytes(postdata);
Web.Navigate(WebBase + WebAddress, WebTitle, SendBytes, "Content-Type: application/x-www-form-urlencoded");
.
and here's the website
<form name="aspnetForm" method="post" action="default.aspx?key=5555" id="aspnetForm">
<input name="ctl00$pass" type="text" id="ctl00_pass" />
</form>
.
tnx
|
|
|
|
|
Hi,
In my C# application, I need to convert EBCDIC data to ASCII. This EBCDIC data is stored as BLOB type in Teradata. This data also has packed decimals in it.
I tried the code i found on internet, which simply converts EBCDIC to ASCII. In that there a interger array of 256 characters only. But the characters which i need to convert,
char chrItem = Convert.ToChar(strEbcidic.Substring(i, 1));
returns number much higher then 256. So i get 'index out of bound of array exception'. The EBCDIC characters include 'ÁõÁõöôùô@@@@ðóùòùùðñ@ððððð' also.
Could any one please help me out here?
Thanks,
Deepa
|
|
|
|
|
I think the problem may be that your input is not EBCDIC - ebcdic is an 8-bit code so only has characters 000 to 255.
Wiki on EBCDIC[^]
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Hi,
Yes, none of these characters in the file are in the 255 codes of EBCDIC.
As i had mentioned earlier, the file from the BLOB, contains packed decimal also.
Are you sure its not EBCDIC, when i do .ToCharArray() i get like:
[0]: 22909 '好'
[1]: 8224 '†'
[2]: 8256 '⁀'
[3]: 8592 '←'
[4]: 879 'ͯ'
[5]: 12629 'ㅕ'
[6]: 16527 '䂏'
[7]: 16448 '䁀'
[8]: 16448 '䁀'
[9]: 16448 '䁀'
[10]: 16448 '䁀'
[11]: 16448 '䁀'
[12]: 16448 '䁀'
[13]: 65533 '�'
[14]: 49605 '쇅'
[15]: 16601 '䃙'
[16]: 16448 '䁀'
[17]: 16448 '䁀'
[18]: 16448 '䁀'
[19]: 16448 '䁀'
[20]: 16448 '䁀'
[21]: 16448 '䁀'
[22]: 16448 '䁀'
[23]: 62448 ''
[24]: 63216 ''
[25]: 63220 ''
[26]: 63473 ''
[27]: 63216 ''
[28]: 62451 ''
[29]: 61689 ''
[30]: 54769 '헱'
[31]: 16448 '䁀'
[32]: 16448 '䁀'
[33]: 16448 '䁀'
[34]: 16448 '䁀'
So their character codes are greater then 255.
How to resolve this?
|
|
|
|
|
The problem is that chars in .NET are Unicode, which is generally two bytes. Using a byte array instead of a char array might solve your problem.
|
|
|
|
|
I highly recommend using Jon Skeet's EBCDIC encoding library[^]
We have been using this for years. You basically just set up Encoding objects and pass them into Stream objects.
Granted, this is VB.NET code, but it should still make sense:
Dim inputEncoding As Encoding = EbcdicEncoding.GetEncoding("EBCDIC-US")
Dim outputEncoding = Encoding.ASCII
Dim inputReader As StreamReader
Dim outputWriter As StreamWriter
inputReader = New StreamReader(inputFile, inputEncoding)
outputWriter = New StreamWriter(outputFile, False, outputEncoding)
I don't claim to be a know it all, for I know that I am not...
I usually have an answer though.
|
|
|
|
|
how to install the Jon Skeet's EBCDIC encoding library[
|
|
|
|
|
Try This
#region public static byte[] ConvertAsciiToEbcdic(byte[] asciiData)
public static byte[] ConvertAsciiToEbcdic(byte[] asciiData)
{
// Create two different encodings.
Encoding ascii = Encoding.ASCII;
Encoding ebcdic = Encoding.GetEncoding("IBM037");
//Retutn Ebcdic Data
return Encoding.Convert(ascii, ebcdic, asciiData);
}
#endregion
#region public static byte[] ConvertEbcdicToAscii(byte[] ebcdicData)
public static byte[] ConvertEbcdicToAscii(byte[] ebcdicData)
{
// Create two different encodings.
Encoding ascii = Encoding.ASCII;
Encoding ebcdic = Encoding.GetEncoding("IBM037");
//Retutn Ascii Data
return Encoding.Convert(ebcdic, ascii, ebcdicData);
}
#endregion
|
|
|
|
|
Hi...
I am using c#.net and sql2005.and in my form i am taking datetime picker for date.in sql taken datatype as datetime. it takes date correctly but it cant take time correctly,taken 12:00 default for all records.
i want to add current date and time in database.
Suggest me something.
|
|
|
|
|
DateTime.Now retrieves the current date and time
I are troll
|
|
|
|
|
If you need the user to be able to select a date and time then set the Format to Custom and the CustomFormat to yyyy/MM/dd HH:mm:ss
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)
|
|
|
|
|
Hi guys. I have managed to resolve a proble I had yesterday with taking a value from one file and searching for it in another file. Now, my file1 containing the values I am searching for has approximately 2000 records in it. I pick up the first id in file1 and search for it in file2 which has approx 80000 records in it. Once the value has been found I replace it with another value from file1. The below code seems to taking forever to run. Is there anyway I can make this run much faster?
fileNot = textBox1.Text;
fileHid = textBox2.Text;
string[] lines = File.ReadAllLines(fileHid);
StreamWriter sw = new StreamWriter(outFile);
foreach (string line in lines)
{
string oldhid = line.Substring(0, 11);
string newhid = line.Substring(14, 11);
StreamReader sr = new StreamReader(fileNot);
string holdLine;
while (!sr.EndOfStream)
{
holdLine = sr.ReadLine();
string matchId = holdLine.Substring(0, 11);
string noting = holdLine.Substring(11, 650).Trim();
string dnot = holdLine.Substring(11, 2);
if (oldhid == matchId && dnot != "D1")
{
sw.WriteLine(newhid + noting);
break;
}
}
sr.Close();
}
sw.Close();
swr.Close();
Any advice woudl be greatly appreciated.
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
Have you try'd doing everything in memory?
Read file 1 in memory (like your doing)
Read file 2 in memory
Do your operations in memory (so the replacing of the id's)
Write to your outfile
As it is now you are creating (opening and closing) 2000 streamreaders, this is bound to be a performance bottleneck.
|
|
|
|
|
Rather than going through the file line by line could you not just search for the index of the word and check if it's right or not (Seeing as you know exactly where everything should be if your using substrings).
StreamReader sr = new StreamReader(fileNot);
string entireFileString = sr.ReadToEnd();
sr.Close();
sr.Dispose();
int location;
while((location = entireFileString.IndexOf(oldhid)) >= 0)
{
}
entireFileString = string.Empty;
Don't forget to Dispose() to clear up memory.
My failometer is detecting vast quantities of FAIL!
"Its SQL - hardly programming..." (Caslen)
modified on Friday, May 15, 2009 8:34 AM
|
|
|
|
|
Hi,
IMO performance can be improved dramatically, however the right tactics depend on some extra info:
- Could you show say 10 lines of each of those files?
= is the order of the output lines relevant?
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.
|
|
|
|
|
[aside] thinking sorted data are we? [\aside]
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
yep.
for performance, always sort; the sort order is not that important, as long as you sort.
if need be, sort an existing collection; better yet sort while collecting.
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.
|
|
|
|
|
While back had to fix a wee oops due to sorting:
Original logic was as items are added repaint the list; even if items are not visible.
Then sparky came along and added a sort. A resort of EVERY row as EACH row was added.
Then users came along and added a shed load of rows.
Can you guess why it took 10 minutes to get 500 items into the list...
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
you violated performance rule #1: don't let the users touch anything.
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.
|
|
|
|
|
I've just signed another item of my list without doing a thing! Bug raised [low priority] 18 months ago has bubblde up for the next phase. Investigate and a fix elsewhere has already resolved it.
Problem is, I've get 2 days on the plan to fill...
[ ]
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
HI Luc. I could post a few lines for you but they are pretty much what I posted in my orriginal post. What I think I want to achieve is read the first ID in FILE1 take that and search for it in FILE2, if found then replace the ID in FILE2 with the ID alongside the one in FILE1. So, File1 has the following data in it:
<br />
C0000000001 C0001000010<br />
C0000000002 C0001000011<br />
C0000000003 C0001000012<br />
FILE2 contains the following data:
<br />
C0000000001N1 SAMPLE NAME 1<br />
C0000000002N5 SAMPLE NAME 2<br />
C0000000123D2 SAMPLE NAME 3<br />
C0000000003N4 SAMPLE NAME 4<br />
Now, FILE1 has approximately 2000 lines of data and FILE2 has approximately 80000 lines of data in it. So in short, take C0000000001 from FILE1 and search through 80000 lines of data and for each instance found replace it with the Value C0001000010 + the remainder of the data in FILE2 on the line and write that to a new file.
Hope this makes sense.
Excellence is doing ordinary things extraordinarily well.
|
|
|
|