|
hi all,
i have a msaccess database with 3 fields 'case', 'dateopened' (day,month), houropened(hour,minute,second) and 'whoopened'.
i have such a data text:
******************** CASE OPENNING RECORDS OF 80 ENTRIES ********************
***************** (MONTH/DAY-HOUR:MINUTE:SECOND-#AUTHORITY) *****************
------------------------------- CASE NO: 9876 -------------------------------
05/12-17:25:05-#3 05/12-17:24:56-#3 05/12-17:24:44-#0 05/12-17:24:32-#3
05/12-17:24:22-#3
---------------------------------- DATA END ---------------------------------
how can i parse this text and get case No and other datas from ?
many thanks in advance.
bye.
|
|
|
|
|
Well, it depends on if you can format the text as you want..
If your text is a bit small (something like few kilobytes), and performance is not an issue here you may want to directly use the (IndexOf) function to locate cretain Keywords (eg. "RECORDS OF ", "CASE NO: ", or "DATA END"), also then you may reformat your data text to be something like this:-
[CASEOPENNING] [RECORDSOF] 80 [ENTRIES]
[DATA]
[CASE NO]9876[/CASENUMBER]
05/12-17:25:05-#3[NEWENTRY]05/12-17:24:56-#3[NEWENTRY]05/12-17:24:44-#0[NEWENTRY]05/12-17:24:32-#3
[NEWENTRY]05/12-17:24:22-#3
[CASE NO]6675[/CASENUMBER]
05/12-17:25:05-#3[NEWENTRY]05/12-17:24:56-#3[NEWENTRY]05/12-17:24:44-#0[NEWENTRY]05/12-17:24:32-#3
[NEWENTRY]05/12-17:24:22-#3
[/DATA]
where you can look to for the index of "[NEWENTRY]".
Then it's easy!!
If your text data is a bit large & you want to boost the performance you may want to try the "ReadLine" function to read your text line by line. Then in the read text parse it with (IndexOf) in a way similar to the above.
There are many other ways to parse and format any text. This was merely a suggestion , Good luck.
|
|
|
|
|
I have image "name.ico", this image have size by ACDSee
48x48x24b;
48x48x256;
32x32x24b;
32x32x256;
16x16x24b;
16x16x256.
I use this code (MSDN):
System.Net.WebRequest request = System.Net.WebRequest.Create("http://.../name.ico");
System.Net.WebResponse response = request.GetResponse();
System.IO.Stream responseStream =
response.GetResponseStream();
Bitmap bitmap2 = new Bitmap(responseStream);
PictureBox1.Image = bitmap2;
this code show image 48x48.
but i need show 16x16x24b.
How to do this?
Please help me!
-- modified at 3:58 Wednesday 17th May, 2006
|
|
|
|
|
Hi,
haven't tested it but you could try:
Icon icon = new Icon(responseStream, 16, 16);
Bitmap bitmap2 = icon.ToBitmap();
This should give you an Icon with 16x16 size but I don't know which color depth will be used...
Probably looking at MSDN[^] would also be a good idea.
|
|
|
|
|
I write next code:
System.Net.WebRequest request = System.Net.WebRequest.Create("http://microsoft.com/favicon.ico"); this image is Ok!
System.Net.WebResponse response = request.GetResponse();
System.IO.Stream responseStream = response.GetResponseStream();
Icon icon = new Icon(responseStream, 16, 16);
Bitmap bitmap2 = icon.ToBitmap();
TabPage1.Image = bitmap2;
it is don't work
in this line error
Icon icon = new Icon(responseStream, 16, 16); ->This stream does not support seek operations.
but:
Icon icon3 = new Icon("D:/Program Files/EasyPHP1-8/www/e107n/favicon.ico", 16, 16);
Bitmap bitmap3 = icon3.ToBitmap();
TabPage2.Image = bitmap3;
is work (16, 16: Ok)
how to fix this problem?
I need load image from Internet.
|
|
|
|
|
You should try loading the whole response into a byte array (GetBytes), create a new MemoryStream with these bytes and use this stream in the Icon constructor. The MemoryStream should be capable of doing seek operations.
|
|
|
|
|
Hi,
I need to hit-test a graphicspath object, the path could have had any number of transformations applied to it. For example, I've added a rectangle (X=50, Y=50, W=200, H=200) to the path, it's been rotated at 45degrees. Now, while it draws correctly, the hit-testing (GraphicsPath.IsVisible) doesn't seem to work with the rotation, if the path hasn't had any transformations applied, the hit-testing works perfectly (the same as Rectangle.Contains it would appear), but when it's transformed...nadda. Doesn't work.
Thanks in advance for any light you may be able to shed!
Kieron
|
|
|
|
|
You should be transforming the mouse coords too I think... it's been a while since I worked with that.
|
|
|
|
|
How to rollback the installation process in case of wrong serial number in c#.net under deployment project ?
manu sharma
|
|
|
|
|
Reinstall and install again
|
|
|
|
|
There are no ways to change the serial number of visual studio. If you want to change the serial number, you must reinstall your visual studio. That's what Microsoft said.
|
|
|
|
|
how i find softwares installed at my pc and also in all pc's at LAN code in c#
i am a student of MSc computer science at quaid-e-azam university islamabad pakistan , my logo is "help to all"
|
|
|
|
|
Hi
I try many time to link flash with c# in visual studio 2005 cloud u help me pleas give me some example and links.
thank's for help
good bye:->
|
|
|
|
|
|
thank's man but can u send me more example???
I try it but all that example are for net 2003 i need it for 2005 pleas help???
-- modified at 10:03 Wednesday 17th May, 2006
|
|
|
|
|
hi,
I am trying to to client side word automation through ASP.NET, C# web based application. Server side word automation can be done easily and i have written the code, so i am able to generate the word document on the server. As per the requirement it has to be generated on the client machine. For this code should be written in some scripting language. Please help!
Thanks,
Avanika
|
|
|
|
|
Hi. I'm trying to use p/invoke on some standard C library. The library defines a struct:
<br />
typedef struct {<br />
FLAC__FrameHeader header;<br />
FLAC__Subframe subframes[8];<br />
FLAC__FrameFooter footer;<br />
} FLAC__Frame;<br />
where FLAC__FrameHeader, FLAC__Subframe, and FLAC__FrameFooter are other copmlex structures.
The library declares a function that consumes a FLAC__Frame as argument, such as :
void someFunc(FLAC__Frame frame);
[These are snippets from libFlac, for those in the know, but this is not really relevant; see here for more on FLAC.]
The question is: how do you marshall the struct to pass it back and forth between C# code and the C library function ?
I've tried to describe the FLAC_Frame structure as this, among other things:
<br />
[StructLayout(LayoutKind.Sequential)]<br />
internal struct Frame {<br />
public FrameHeader Header;<br />
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]<br />
public Subframe[] Subframes;<br />
public FrameFooter Footer;<br />
}<br />
<br />
[DllImport("libFlac.dll")]<br />
private static extern void someFunc(Frame frame);<br />
but I keep getting a TypeLoadException with the comment "Cannot marshal field 'Subframes' of type 'Frame': There is no marshaling support for this type."
It does not seem to like the array of Subframes embedded in the Frame structure.
Anybody would have hints ?
Thanks,
Pyt.
|
|
|
|
|
|
Yes, indeed. Sorry if this wasn't clear.
Subframe is a struct containing other structs (there are actually several levels of nested structs).
Pyt.
|
|
|
|
|
I was thinking, the exception thrown probably has inner exceptions, that might give you more detail. Failing that, try Marshal.SizeOf() on the SubFrame, if u get a number back and no exception, then it should work.
Finally failing that, you can define 8 structs in a 'row' perhaps.
|
|
|
|
|
Well, there was no inner exceptions. I finally put the 8 structures in a row, and it worked. Not very handy, but it'll do the trick for now. Thanks.
Pyt.
|
|
|
|
|
Hi,
I'm converting char[] to double using
Dlength = System.Convert.ToDouble(strdata);
But its throwing exception called "Unable to cast object of type 'System.char[]' to type 'System.IConvertible'.
Any idea?
|
|
|
|
|
Assuming that the char[] contains something like { '9', '.', '2', '5' } then you should convert the array into a string, then pass that into the ToDouble method.
Josh
|
|
|
|
|
<br />
char []ch = {'1','2','3','.','2','3'};<br />
String str = new String(ch);<br />
Console.WriteLine(Convert.ToDouble(str));<br />
Hope this would solve the problem.
Saqib
|
|
|
|
|
I have a sequence of 8-9 non ADO.Net operations needs to be done as a transaction. All of these should happen together or none of them. Is there any transaction support in C# for non ADO.Net operations?? If not what would be the best way to code this situation.
|
|
|
|