|
After the user selects the text file from the OpenFile dialog
use the richtextbox.loadFile() method and specify the filename in the method.
Thanks & Regards,
Pramod
"Everyone is a genius at least once a year"
|
|
|
|
|
But how to store the selected file name at run time,so that I can pass the parameter to load File method
|
|
|
|
|
if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)<br />
{<br />
richTextBox1.LoadFile(openFileDialog1.FileName);<br />
}
You can store FileName in registry
Chatura Dilan
SC Java Programmer
|
|
|
|
|
u can use a global variable to store the name of selected file (at the event the file is being selected) and then use that variable to pass it to the method.
sAqIb
|
|
|
|
|
Please I need to use the class of TapeOperator in .Net framework 2003.
|
|
|
|
|
Yes, and?
--------------------------------------------------------
My portfolio & development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
how do we use global variables in C#???
reply soon
STABd
|
|
|
|
|
You don't, there is no such thing.
You can use static classes/variables for the same purpose.
|
|
|
|
|
1. Make sure that you really need the global variable.
2. Use a singleton with public properties, or a structure with public static variables.
____________________________________
There is no proof for this sentence.
|
|
|
|
|
:|everything is encapsulated inside objects. that being the case, no there are no global variables in .net.
you can make "global" variables with a singleton object:
public class Global {<br />
private static object syncLock = new object();<br />
private static Global instance;<br />
public static Global Instance {<br />
get {<br />
lock(syncLock) {<br />
if(instance == null) instance = new Global();<br />
}<br />
return instance;<br />
}<br />
}<br />
private Global() { <br />
one = 1;<br />
two = false;<br />
er = 0.2F;<br />
} <br />
private int one;<br />
private bool two;<br />
private float er;<br />
<br />
public int One { get { return one; } set { one = value; } }<br />
public bool Two { get { return two; } set { two = value; } }<br />
public Float Er { get { return er; } set { er = value; } }<br />
}<br />
<br />
<br />
<br />
Global.Instance.One = 7;<br />
<br />
<br />
int oneVal = Global.Instance.One;
STABd
|
|
|
|
|
You can use a global variable by declaring it as static member of the class. e.g
public static int var;
now the variable 'var' will be used as global variable.
Regards
sAqIb
|
|
|
|
|
Hi all,
I have created an windows application, now i want to embed this
application in a web browser.
The first question is whether this is possible?
and if possible, how do i do that?
Please direct me to some good source for the same.
Thanks & Regards,
Pramod
"Everyone is a genius at least once a year"
|
|
|
|
|
As far as I know that is not possible (99.99% shure).
--------------------------------------------------------
My portfolio & development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
|
I heard something as "Click-Once" that allows you to use those Forms as Java applets in the web.
|
|
|
|
|
Hi,
I've been looking for like 2 hours for a method or anything that reads the text which is typed in a textbox.
I don't really know much about buttons and textfields. I usually work with the console.
Can anyone tell me how to read in text from a textbox plz?
Thanks in advance!
|
|
|
|
|
suppose that u want to retrieve the data of the textbox to a variable
u can do it by the foll code:
string data=textboxname.Text;
NEHA GUPTA
|
|
|
|
|
hi
textBox1.text will give you the text is typed in textBox1
Tamimi - Code
|
|
|
|
|
Hi Tamimi,
That worked! Thank you!
I declared readIn to read what is typed in the textbox like this:
string readIn = this.texBox1.Text;
And attaching it to the eventhandler like this:
readIn += new KeyEventHandler(texBox1_KeyPress);
It gives me the error:
No overload for 'texBox1_KeyPress' matches delegate 'System.Windows.Forms.KeyEventHandler'
What am i doing wrong?
|
|
|
|
|
hi
could you give more details about what you are trying to do ??
if simply you want the text in a textbox the .Text property its enough
and no need to attaching anything.
what exactly you want to do ??
Tamimi - Code
|
|
|
|
|
Hi,
I want to accept only 0, 1, 2 .... 9 as input. In order to do this, i have to attach texbBox1.Text to the keypressed handler.
But i got it fixed now,
Thank you!
|
|
|
|
|
hi
is there any wrong with this:
private void textBox1_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e) { int intKeyValue = (int)e.KeyChar; if (((intKeyValue<48 || intKeyValue>57 ) && intKeyValue!=46)) { e.Handled = true; } }
Tamimi - Code
|
|
|
|
|
Hi Tamimi,
There is nothing wrong with that method.
In fact, thats the eventhandler i was trying to attach 'readIn' to.
If a key is pressed 'readIn' will call that eventhandler to check if its a valid one.
Sorry for the confusion Tamimi!
|
|
|
|
|
hi
are you trying to do this:
this.textBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress);
if not feel free to ask again
Tamimi - Code
|
|
|
|
|
Hi Tamimi,
Thats exactly what i meant. But i fixed that half an hour ago
I do have another question...
If i want to get everything between 2 chars, how would i do that?
Example:
[1]
[12]
[123]
How would i get everything between the '[ ]' chars?
Substring wont help, coz the characters inside the [] can be sometimes 1, 3 or more.
Thanks in advance!
|
|
|
|