|
Thanks for the example!
I tried to "copy" the result into a TextBox.Text instead of the Console.Writeln, but there was no result displayed.
Well actually when I will start parsing the string I do not know what it will look like! The string above is just an example!
It could even look like this:
Winter, John\r\nMobile 1: +23 (456) 22562\r\nMobile 2: +23 (456) 22563
besides I have to replace the "+" by a predifined string, which finally should be selectable in the Options. At the moment I do want to replace this by "00". And another change which might effect the example: My parsing should be able to parse the string no matter if it's fieldnames are German, English, French or whatever, but as far as I understood, this does not matter.
Well I guess I have to adapt the algortihm above so it also works with
Winter, John\r\nMobile 1: +23(456) 22562
meaning it should work with no matter how many telephonenumbers might be in the string. That's why I didn't try to use a "kind of fixed string" like yours. But maybe it will work too.
My problem actually is I do not have to just display the numbers on screen, I do have to save them somewhere. Because if the string which has to be parsed just contains one number, than it's the number the user (of my proggy) will work on with. But if there are more than one, I have to create a kind of popup for the user choosing one of the numbers. So I have to store them in a kind of array, because as I mentioned earlier I do not know how many numbers are in the string when starting to parse. In your example I do throw the string away after displaying, but well, I have to save it. Maybe that's a little more difficult, because it didn't work replacing Console.Writeln by TextBox.Text and doing a cast to string.
Stephan.
|
|
|
|
|
Anyone know how i can change the font size on a SysListView32?
I currently have the hwnd of the window and have tried using the following statements:
System.Drawing.Font f = new System.Drawing.Font("Arial",20);
SendMessage(hwnd,WM_SETFONT,0,f.ToHfont());
Any Sugestions?
Thanks in advance
|
|
|
|
|
Dave@KeySpell wrote:
Any Sugestions?
This works for me:
private int WM_SETFONT = 0x0030;
[DllImport("user32.dll")]
static extern IntPtr SendMessage(IntPtr hWnd, int Msg,
IntPtr wParam, bool lParam);
Font f = new Font("Arial Black", 12);
IntPtr hFont = f.ToHfont();
SendMessage(view.Handle, WM_SETFONT, hFont, true);
- Nick Parker My Blog | My Articles
|
|
|
|
|
Thanks very much Nick
It works a treat, I was just using the wrong overload SendMessage.
Dave@KeySpell
|
|
|
|
|
MSN Messenger uses a SysListView32, you should send that code to it. That would be intersting...
/\ |_ E X E GG
|
|
|
|
|
How we make changes(color, font, add, remove etc. of one or more items) in a richTextBox without flickering ?
|
|
|
|
|
I found THE PERFECT SOLUTION at :
http://www.theimagingsourceforums.com/showthread.php?threadid=316120
|
|
|
|
|
I am a newbie in C#, could anybody help me do it! Thanks a lot!
#include<stdio.h>
#include<math.h>
#define BUFFERSIZE 0x100
FILE *fp1,*fp2,*fp3,*fp4;
main(int argc,char*argv[] )
{long timer[20];
int i,kl,kkl,n,vsp;
float vsp1,ps1,bn1,vsp2,ps2,bn2,vsp3,ps3,bn3;
char *dats=".dat";
char buffer[128],f,buff[100],newname[30],newaa[20],time[10];
if(argc!=4)
{ printf("you forgot to enter a filename\n");
exit(0);
}
if((fp1=fopen("zd8bxxx.ddd","wb+"))==NULL)
{ printf("input file open file\n");
exit(0);
}
if((fp2=fopen(argv[2],"ab"))==NULL)
{ printf("output1 file open file\n");
exit(0);
}
if((fp3=fopen(argv[3],"ab"))==NULL)
{ printf("output2 file open file\n");
exit(0);
}
fread(&time,sizeof(char),8,fp1);
for(i=2;i<8;i++)
newname[i-1]=time[i];
newname[0]='d';
newname[7]=0;
for(i=0;i<7;i++)
newaa[i]=newname[i+3];
strcat(newname,dats);
if((fp4=fopen(newname,"wb"))==NULL)
{ printf("output file open fail\n");
exit(0);
}
fread(&timer,sizeof(long int),14,fp1);
for(i=0;i<24;i++)
{
fread(&buffer,sizeof(char),48,fp1);
vsp=ff(buffer[0],buffer[1],buffer[2],buffer[3]);
vsp1=(float)vsp/10;
ps1=(float)ff(buffer[4],buffer[5],buffer[6],buffer[7])/100;
fprintf(fp2,"%4s%5d%8.1f%7.2f\n",newaa,i,vsp1,ps1);
fprintf(fp4,"%4s%5d%8.1f%7.2f\n" ,newaa,i,vsp1,ps1);
}
fread(&buff,sizeof(char),48,fp1);
fread(&buff,sizeof(char),48,fp1);
vsp1=(float)ff(buff[0],buff[1],buff[2],buff[3])/10;
ps1=(float)ff(buff[4],buff[5],buff[6],buff[7])/100;
bn1=(float)ff(buff[8],buff[9],buff[10],buff[11])/100;
fprintf(fp3,"%6s%8.1f%8.2f%8.2f\n",
newaa,vsp1,ps1,bn1);
fclose(fp1);
fclose(fp2);
fclose(fp3);
fclose(fp4);
}
|
|
|
|
|
|
Are you sure you want to? Looks like it needs quite a bit of refactoring, starting with the basics like having a more descriptive function name than "main()". It might make more sense to identify exactly what you want to do and just write it in C#. It'll probably be simpler, clearer and smaller.
By the way, if you want to persist along the line of getting someone else to write it for you, without even saying what it is or how it should work (or is that top-secret classified information on a need-to-know basis only?) , you should at least repost the code, but make sure to check the "Do not treat <'s as HTML tags" checkbox, so that all the code shows up. Also, use the code tag or the pre tag around your code and it'll be more readable.
Matt Gerrans
|
|
|
|
|
Hi guys,
How can we find a path of an exe using it's name?? The exe is some third party exe and can be anywhere in the system. How can I find the path?? MY requirement is to start this exe from my Service. Can any body help me with some code snippet? It's very urgent.
Regards,
Satya.
|
|
|
|
|
There is no general way to do this.
Usually an application that can be installed anywhere will create a registry entry holding the installation path. Take a look at HKLM\Software, you might be lucky and find an entry for your third party exe.
Other than this you'd have to scan the hard discs of the target computer, which usually isn't feasible.
Or you ask the user during installation by presenting a file open box with the exe filename as filter and then store the path in your configuration.
Regards,
mav
|
|
|
|
|
Hi,
Do you have any code snippet for finding the exe using Registry method.
If you have please give me, it's very urgent and I can't make much trails now.
Regards,
satya
|
|
|
|
|
As I stated before, there's no way for me to know where (if at all) the third-party program might store its installation path.
Open RegEdit and browse HKLM\Software\<name of the third-party company>\<name of third-party program> if it exists and perhaps you'll find a matching entry.
If you found such an entry you can access it from your service using the Microsoft.Win32.Registry and Microsoft.Win32.RegistryKey classes.
Regards,
mav
|
|
|
|
|
If it is a program in the path, then you can use the SearchPath() API function (I'm not sure if there is an analog somewere in the .net library; you'll have to look for it and if you don't find it, just do a little DllImport ).
If it isn't in the path, then you need to do a little of your own research to determine what's the best way to find it. As mav has suggested, it may be in the registry, but its exact location can be arbitrary, of course, so you need to do a bit of research on the particular application you are dealing with (i.e. use RegEdit).
Matt Gerrans
|
|
|
|
|
Dear DotNet gurus,
I want to build a custom browser that is capable of capturing GET and POST requests (along with headers)for one of my class projects.
I use the Microsoft Web Browser component to do the same. I register events like NavigateComplete2, BeforeNavigate2 and DownloadComplete but none of them provide me with complete POST headers.
The "header" member just provides "Content-Type: application/x-www-form-urlencoded"
I have tried really hard but am dissapointed because i couldn't figure out a way to capture the POST headers.
I would really really appreciate if someone could tell me a way i can figure out the POST headers.
A solution using event handlers, or even something/someway of reading the raw socket will be of great help.
Please help me.
Thank you
Ranu
|
|
|
|
|
I am creating an application for invoice printing and also data collection.
I created a form for the user to input all the data.
It basically save all the information that the user had input, and then print the invoice of it.
I only know that there are two ways of doing this. Creating the print out by coding, or with crystal report.
I just confused on choosing which one to use, since I am a newbie in C#.
Does anyone have any opinion or idea?
Thank you very much in advance.
|
|
|
|
|
check out the link below, hope it's useful
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwinforms/html/printwinforms.asp
regards
|
|
|
|
|
Hello Gurus,
How can I color a DataGrid row (or a certain cell) with any colors at will, not just "Alternting Color"?
Thanks with a $ billion!
Khang Nguyen
|
|
|
|
|
|
Dear Guru Jay, thanks so much for the tip. Let me look at it and try it out with my project & let you know. Probably, it will take me some time. -Khang-
|
|
|
|
|
Guru Jay,
It seems working out for me. Thanks so much!!!
|
|
|
|
|
It should be simple right? Is it possible to add a class file to my project without it copying locally to my project? I just want to "include" it from a specific location. Maybe I am adding the file to my project the wrong way...
|
|
|
|
|
Okay i'm an iditot
Anyway when you select "Add exsisting item" if you hit the little arrow on the "Open" button you can select "Link" which will include it from another location.
It took me a while to find that so I am explaing it here incase someone uses search
|
|
|
|
|
Kluch wrote:
It took me a while to find that so I am explaining it here in case someone uses search
Excellent policy! Its always nice to find answers along with questions when searching. What's really annoying is the "I finally figured it out." follow-up, without the answer.
Matt Gerrans
|
|
|
|
|