|
It's the stangest thing! It works with selectedRTF, but not RTF. Thanks, I would have probably never have tried that.
For anyone else doing this - don't forget a space after the "\v".
|
|
|
|
|
I'm working on a program that is a shell for a command-line DOS program. All it does is go through a list of files and for each one it calls a dos program using a System.Diagnostics.Process, waits for it to finish, moves to the next file, etc. Things run smoothly for small numbers of files, but if I use a big list of files, the whole thing locks up for about a minute (task manager says it's "not responding") and then it finally finishes up and gets back to drawing the window and such. I'd see how this could happen if it was just one big call to the dos program, but it's a lot of little calls, with time in-between. What can I do to smooth this out?
|
|
|
|
|
You should maybe spawn a worker thread to do the call outs and stick a Progress dialog up on the screen with a message pump to keep your UI messages processsed properly while it's doing it!
-----------------------------------------------------------------------
Shaun Austin: .NET Specialist. Spreading the word of .NET to the world... well the UK... well my tiny corner of it!!
|
|
|
|
|
Hehe, thanks I was thinking about that. Only thing I don't understand - what's a message pump? I've only written multithreaded apps in C for command-line, so I'm not sure how they work for windowed apps. In fact, I'm not sure how to correctly design windowed apps in general...
|
|
|
|
|
;PAnyone knows How to disable the WebBrower Control's Scroll Bar in the Right side ?
Neo
|
|
|
|
|
hello
i am again on today,
take my question, i have a fixed length file which has basically some ship to records. in those records i have got japanese characters also. Since it is a fixed length file, i wanted to extract data by specifying width. The problem is some japanese characters occupies more than one byte, in those scenarios if i use substring function i am not extracting correct information.
say suppose you need to extract 32 bytes of data from a string. if i do char by char opperation i will end up extracting information from other fields.
my question is how do i read a string byte by byte in C#.
please help me
thanks
Cheers,
Venkatraman Kalyanam
Chennai - India
"Being Excellent is not a skill, it is an attitude"
Reality is an illusion caused by caffeine deficiency(one Microsoft Research scholor)
|
|
|
|
|
Venkatraman,
You could use System.IO.Stream to access the file byte by byte you could then user myStream.ReadByte() which returns an unsigned byte cast to an Int32 or -1 if the end of the stream!
HTH
Shaun
-----------------------------------------------------------------------
Shaun Austin: .NET Specialist. Spreading the word of .NET to the world... well the UK... well my tiny corner of it!!
|
|
|
|
|
I would like to know how to extract bytes from a string.
Cheers,
Venkatraman Kalyanam
Chennai - India
"Being Excellent is not a skill, it is an attitude"
Reality is an illusion caused by caffeine deficiency(one Microsoft Research scholor)
|
|
|
|
|
Hi, friends! I met a hard question ! How can I do a Find and Replace function ? thx!
|
|
|
|
|
JeffSayHi wrote:
How can I do a Find and Replace function
Ctrl - H
or
String.Replace()
or
RegEx.Replace()
in order of difficulty to use
<a TITLE="See my user info" href=http:
|
|
|
|
|
In the directory C:\Program Files\Microsoft Visual Studio .NET\Common7\Graphics\videos Microsoft put sample avi files. I think so people can use them in there applications.
I've search the web, but I can't find any C# example how to display search.avi on a form.
Does any one know how this can be done?
Thanks,
Patrick
|
|
|
|
|
Not entirely sure. I know that MFC had a class called CAnimateCtrl which used the ActiveMovie control. This is still available in the COM tab of the component toolbox add/remove dialog so I'm sure you can use Interop to use that.
Worth a try!
HTH
Shaun
-----------------------------------------------------------------------
Shaun Austin: .NET Specialist. Spreading the word of .NET to the world... well the UK... well my tiny corner of it!!
|
|
|
|
|
Shaun,
It works with this control.
It's not exactly what I want. The search.avi needs to play in a loop and be transparent.
Thanks, I'll keep looking.
Patrick
|
|
|
|
|
I have an assembly that is loaded by a .exe. The assembly is interested of knowing where is the application's exe is located on disc, in order to find its configuration file.
I would like to do this so the application can monitor the switches section to enable and disable tracing without restarting the application.
|
|
|
|
|
This will probably give you the current assembly and not the .exe, but this is what I use from within an .exe to find its location.
string path = System.IO.Path.GetDirectoryName( <br />
System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);<br />
path = path.Remove(0,6);
Perhaps changing GetExecutingAssembly() to GetCallingAssembly() would get you the results you need.
>>>-----> MikeO
|
|
|
|
|
if you are housing your own exe in the path you want you can do this :
private void button8_Click(object sender, System.EventArgs e)
{
try
{
string s=Application.ExecutablePath.ToString();
MessageBox.Show("my .exe directory is:\n" + s);
}
catch
{
System.Exception f = new System.Exception();
MessageBox.Show(f.Message);
}
switch(twinsOnWay)
{
case ("twins on the way"):
MessageBox.Show("for mr and mrs dynamic","twins on the way");
break;
|
|
|
|
|
I am having a hard time trying to implent winforms gui event handling. I have an mdi application where the the child form displayed depends on what which linklabel or button the user clicks (there is more than one way in different parts of the app to reach the same form). I want to pass the name of the form to display. I am trying to separate the event handling from the form (is this good app architecture?). Here is what I have so far, I know I am missing something, but I don't know what is . Any help please?
//define delegate
public delegate void DisplayFormEventHandler(object sender, DisplayFormEventArgs e);
//create custom event
public class DisplayFormEventArgs : EventArgs
{
//Define and initialize two variables)
}
//handler to be executed when event fired
public class DisplayFormHandler
{
public void windowToDisplay(object sender, DisplayFormEventArgs e)
{
switch(componenetClicked)
case "Orders":
//code here
case "Settings":
}
}
//event sender
public class Home : System.Windows.Forms.Form
{
private void InitializeComponent()
{
LinkLabel newOrdersLink = new LinkLabel();
newOrdersLink.Click += new DisplayFormEventHandler();
}
}
|
|
|
|
|
When I programed in C, I use memcpy function to change a struct to a string.
Ex:
struct A
{
int x;
...
};
...
A a;
char str[50];
memcpy(str,&a,sizeof(A));
...
However, when I write in C#, I also want to convert a class/struct to string but I don't.
Can you help me?
Thanks
|
|
|
|
|
You can do it this way:
A aa = new A();
string myString = aa.x.ToString();
|
|
|
|
|
Thank you for your answer, but I want to convert a string to a class/struct because I write an application using Socket, Server module wrote in MFC 6.0 and client module I write in C#, data from Server send to Client are records which converted to string and pass throught metwork. Now, I want convert this data to struct/class after receive string data from server.
Please help me. It very importance for me.
Thanks.
|
|
|
|
|
Hi
Is this possible (in .NET RegEx)? Eg.
pat1 = (?<pat1>\w?(pat2)\d?)
pat2 = (?<pat2>\.?(pat3)\@?)
...
Thanks
|
|
|
|
|
try the regularexpression clas
using System.Text.RegularExpressions;
and then you can match with
Match m = Regex.Match(strText, @"(?\w?(pat2)\d?)", RegexOptions.IgnoreCase);
if (m.Succes)
{
string value = m.Groups[1].Value.ToString(); // like $1 in Perl
...
}
or
Regex.Replace(strTex, @"(?\w?(pat2)\d?)", @"<replacewith>", <regexoptions>)
If you come from Perl you don't need to break the / or \ (=~ /\// | =~ /\\/) but you need to "break" the " with double them
Regex.Match(strText, @"value=""(.*?)""\s*>", RegexOptions)
Hope this will help!
|
|
|
|
|
Thanx for the reply, but this is exactly what I dont want to do!
There mite be a 100 sub patterns. A lexical analyzer can handle this easily, but is this possible in RegEx?
<a TITLE="See my user info" href=http:
|
|
|
|
|
I have a WinForm app that is fine and dandy when executed as a simply local exe. I'd like to host it via a webserver (http://blahwebserver/MyApp/Myapp.exe). I've gotten through a few initial issues which brought to light some holes in exception handling, but I'm really running into a problem with the config file apparently not being loaded. I don't really know what to do about this or where to research on it, though I kinda hoped it would have been mentioned in here[^] but it wasn't. So I've got nothing at this point.
|
|
|
|
|
If you have ASP.NET running on the server, it might be blocking access to the .config file because of a bug in .NET 1.0.
Edit the machine.config* [edit]on the server[/edit] and change line 447 from
path="*.config"
to
path="web.config"
This will allow your app.config file to download but still block downloading of the web.config file.
[edit]*On my computer it is at: C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\CONFIG
If you have .NET 1.1 installed on the server then this change has already been made, but if you told IIS to use .NET 1.0 for that application (or for the whole server) then you still need to edit the machine.config[/edit]
James
"I despise the city and much prefer being where a traffic jam means a line-up at McDonald's"
Me when telling a friend why I wouldn't want to live with him
|
|
|
|