|
No.If just showDialog.The Main Form stoped execute.I need show the popup form,and the main form still execute.
|
|
|
|
|
Ummm, you wanted to show a Modal Dialog. The UI thread on the form that launched the modal stops executing until the modal dialog is dismissed. That's the expected behavior.
If you have to have elements on the main form still responsive to the user, you have show the dialog as a normal form, not modal. If you just have code in the main form that needs to execute without user or UI interaction, then you have to move that code to a seperate thread, then you can show your other dialog modal.
|
|
|
|
|
Hi
Let's think that there is an application which asks you your name at the first start. You enter it and it saves it. Next time you start the application, it doesn't ask your name. It says "Hello ....." .
But it doesn't save your name to registry nor a file. Is this possible? And how can I do this?
Actually this is just a simple example to tell you what I want to do. In short I want to save a string into the EXE, but it should be changeble by the same application.
Thanks.
|
|
|
|
|
Ive never done it, and dont know if possible but i can offer a theory that may lead you somewhere:
Lets say for example you hardcode a string that is 100 chars long. When you compile you application that string is stored in the .exe somewhere. Now if you could find out how .exe are compiled you may be able to find the byte range for that hardcoded value somehow. Then maybe you could write what ever string to that byte range and it would save... Theoretically.
Of course you will have to get around a write issue, when trying to write to the app you are running lol
Maybe, you have a second app that is called, closes the first app, writes the value, then executes the first app again. This is getting rather tediuos thou so im sure you want want to take this route.
But if you do go for it, then dont forget to post any results you find, im sure people would be interested
My opinion is... If someone has already posted an answer, dont post the SAME answer
|
|
|
|
|
Hey, i think im onto something:
I open my .exe in a hex editor (PSPAD) and found the string towards the end of the file. coded in ASCII but split with 0x00 values. can see the offset so know where to edit, problem being modifying the app will prob move the location of the string
My opinion is... If someone has already posted an answer, dont post the SAME answer
|
|
|
|
|
"coded in ASCII but split with 0x00 values"
That'll be a 16 bit unicode then!
Alan.
|
|
|
|
|
well i assumed it was 16 bit values
My opinion is... If someone has already posted an answer, dont post the SAME answer
|
|
|
|
|
Finding and writing the string to and .EXE file is only one problem. The other problem is that you can't modify an .EXE file if it's currently running. You'll need a second app that takes the parameters and waits for the main .EXE to end, then it can modify the .EXE.
Though, this really isn't a good idea since it's not "version agnostic". If you make a small change to the code and recompile into a new .EXE, the string can very easily change position in the file.
Oh! And if the resulting .EXE is signed with a digital signature, you'll break the security envelope around the .EXE and the code won't run since it will no longer be trusted by the .NET CLR.
|
|
|
|
|
So, instead of my writing into EXE idea. What can I do to change a variable within the application and keep that variable same after I restarted it?
By the way. As an extra idea, how can I make an application which creates another exe from itself with modifying a variable or value of itself?
I have looked for it in Google. But I haven't find satisfactoring answers to my questions.
|
|
|
|
|
SimpleData wrote: So, instead of my writing into EXE idea. What can I do to change a variable within the application and keep that variable same after I restarted it?
There is no alternative, other than saving in the Registry or files external to the .EXE.
SimpleData wrote: As an extra idea, how can I make an application which creates another exe from itself with modifying a variable or value of itself?
The same way you read/write any binary file. Read the .EXE file until you get to the point where the string is, write all that data to a new file, then write the string data, skip reading the string in the source .EXE file, and continue to read the old file to the end, writing it's data to the new file.
But, you have a problem. You STILL need an external application to delete the old .EXE and rename the new .EXE to the old filename. Not, a good solution...
|
|
|
|
|
Ya You Can by creating a variable in the settings of an application.
. on Form load you can call that for ex.
where VariableName is a variable which u need to create in settings of the application
and txtbox1 is a textbox.
public form1()
{
InitializeComponent();
txtbox1.Text = Properties.Settings.Default.VariableName;
}
and on form close you need to save that
private void form1_FormClosed(object sender, FormClosedEventArgs e)
{
Properties.Settings.Default.Save();
}
Thanks.
Sandy
|
|
|
|
|
You may want to go back and re-read the thread, plus read the documentation on Properties.Settings.
You missed the entire point of the conversation. The OP wanted to save "settings" back to the .EXE instead of a seperate *.settings file. You cannot do that in a "nice" manner. He did NOT want to use an external file, which is what you're proposing doing.
|
|
|
|
|
But then it wouldn't work properly if the system has multiple users.
And what if the user types the name wrong or something?
I suggest saving to a file (I'd use XML), perhaps in the user's "Application Data" directory.
You could also use a database, especially if the user may use several different systems.
|
|
|
|
|
Hello,
I have the need for spell checking in my windows forms application.
I initially attempted my own using a Forms.RichTextBox which didnt turn out too badly, i got spelling mistakes to highlight with red font.
Then i found out the the WPF RichTextBox has spell check functionality, including red squigly line and correct spelling suggestions.
So i looked for a way to have the WPF RichTextBox in my appliation. The solution i found was to use an elementHost in my app and then have the WPF RichTextBox as a child of that.
This solution works, i have all the functionality i require.
The problem is, its causing performance issues when loaded any form containing the control. or rather the customControl i have made which contains the WPF RichTextBox. This custom control also contains a toolStrip with a number of buttons for formatting the WPF RichTextBox content.
Can anyone offer an explaination to the delay in initialisation? Or any alternatives for how i can use the WPF RichTextBox in my WinForms Application?
Any help is greatly appriciated, as always
My opinion is... If someone has already posted an answer, dont post the SAME answer
|
|
|
|
|
WPF is slow to load, especially the first time it is used in an app.
If your users have Word, you can use Word for spell check.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Thanks for your reply, I will take a long into using word.
Thou i do use for some mail merging and that can be slow to init the word application so will have to see how well it works for spell checking.
Thanks again
My opinion is... If someone has already posted an answer, dont post the SAME answer
|
|
|
|
|
I need to parse Log files with different operations that will require different grammars as each operation is organized differently. I have been using
char[] delimiterChars = { ',' 'WHATEVER' }; to detemine what gets parsed. the problem with that is, it does not seem to discriminate which parameter it chooses and when. Is there anyway to make it a little more automated instead of just creating a whole bunch of delimiter chars and then calling them in order at which they wouldd appear?
|
|
|
|
|
I have no idea as to what you mean... please examplify
My opinion is... If someone has already posted an answer, dont post the SAME answer
|
|
|
|
|
Can you provide a small sample of the various types of data?
|
|
|
|
|
directly from the log file:
E 12:28:45 Line 1 : Dispense
tip 1 : dispense 0.00nl 1, 1 Deep Well, landscape [1,1]
10.00µl ">> Water << 23" Fixed <3 - 50µl> Single
E 12:28:47 Line 2 : Aspirate
tip 1 : aspirate 60.00µl 1, 1 Deep Well, landscape [1,2]
10.00µl "Water" Fixed <3 - 50µl> Multi
E 12:28:45 Line 1 : Dispense
tip 1 : dispense 0.00nl 1, 1 Deep Well, landscape [1,1]
10.00µl ">> Water << 23" Fixed <3 - 50µl> Single
E 12:28:47 Line 2 : Aspirate
tip 1 : aspirate 60.00µl 1, 1 Deep Well, landscape [1,2]
10.00µl "Water" Fixed <3 - 50µl> Multi
|
|
|
|
|
scratch the last reply...
these three commands are the bread and butter of the operations. most are just combination of these 3...
E 12:28:45 Line 1 : Dispense
tip 1 : dispense 0.00nl 1, 1 Deep Well, landscape [1,1]
10.00µl ">> Water << 23" Fixed <3 - 50µl> Single
E 12:28:47 Line 2 : Aspirate
tip 1 : aspirate 60.00µl 1, 1 Deep Well, landscape [1,2]
10.00µl "Water" Fixed <3 - 50µl> Multi
E 12:28:57 Line 3 : Wash Tips
wash (2ml + 1ml), grid 26 and grid 26
now they look similar but each hasa different set of information needed to cut out or set as variables. I do plan on calling a "dispense", "asperate" and "Wash Tips" grammar structure when needed. if i tell it to parse at the comma's, i will get data that i dont want. I could remember each value of the word, and set that to a variable like word[1]=volume and word[5]=fluid type but i dont really want to do that. is there any way to make it a little more automated so that it knows the sequence to skip over bits not biased on charactor length as that will change as well.
|
|
|
|
|
Hi,
I've reviewed your posts on the topic of parsing these instrument log files. What I haven't got from any of your questions is what information you want to extract.
So, for example, in the log just posted what output do you want?
Alan.
|
|
|
|
|
Oh, this is the same thing I've seen posted before.
I'd use a Regular Expression. Not having much else to do today, I think I'll experiment a little... I'll be back.
|
|
|
|
|
So far I've created this Regex:
System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex
(
@"(?'Type'\S)\s(?'Time'\d\d:\d\d:\d\d)\sLine\s*(?'Line'[^:]*)\s:\s(?'Operation'[^\r]*)\r\n(?'Data'([^\r]*\r){1,3})"
,
System.Text.RegularExpressions.RegexOptions.Compiled |
System.Text.RegularExpressions.RegexOptions.Singleline |
System.Text.RegularExpressions.RegexOptions.CultureInvariant
) ;
It matches the three log entries you provided and provides the named groups:
E 12:28:45 Line 1 : Dispense
- -------- - --------
| | | |
| | | Operation
| | Line
| Time
Type
and then the following two or three lines go into Data
You can then use the Operation to determine further processing of the Data, perhaps each operation would have its own Regex to parse its data.
|
|
|
|
|
Sorry for the late reply I thank you for the help. So far you have pretty much hit the pin on the head. The problem here is... I dont know what you mean by regular expressions and how I would build them for each operation. Ill show you the desired data and maybe give some pointers on how to create one for this operation and then Ill be able to use that to create more. This is the dispense operation.
tip 1 : dispense 0.00nl 1, 1 Deep Well, landscape [1,1]
----- | | | |
| | | | |
a b c d e
10.00µl ">> Water << 23" Fixed <3 - 50µl> Single
----- ----
| |
| |
f g
Also, my plan right now is to take each word that is parsed in the array, assign the desired arrays with the proper variables (time=word[8]) and work it that way. Im not sure if that is the most effective way to do it, im sure it will work but maybe not the best.
|
|
|
|