-
Keys
-How Would I Fix this error
(Where & How do I mark the STAThreadAttribute )
-This Occurs when I'm in a textbox (a large one) and execute a notepad-like cut or paste or copy
Error:
System.Threading.ThreadStateException: The current thread must set to Single Thread Apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it.
What's the " Main Function ", the cut/copy/paste functions are like 3 lines long
ideas ?
-
There has to be a main function in your program. You need to mark this with the "STAThread"-Attribute.
PHP Code:
[STAThread]
static void Main()
{
Application.Run(new frmMain());
}
-
Excellent !
As a design idea, Would Using a Large "Docked" Textbox be the best way to create a quasi Notepad ?
Also, Tabs Don't Work ?
Comments Welcome...
-
A docked Textbox should be ok.
Tabs work fine, what exactly is not working in your program ?
-
What I mean by tabs is that when your in the huge textbox and press tab, a tab doesn't appear like in notepad, the program tries to find the next TabStop.
I'd like to implement a "Visual Studio like tab" where I can hilight several lines of text and tab them all together
-
KEYS KEYS KEYS
OK, you have to set the box to accept tabs.
How do we test to see if SHIFT+TAB was pressed in :
Code:
protected void textBox1_TextChanged (object sender, System.EventArgs e){
if ((Control.ModifierKeys | (Keys.Shift & Keys.Tab)) != ( Keys.Tab & Keys.Shift) ) {
MessageBox.Show("Pressed --> Shift + Tab");
}
}
It Enters with Ctrl+z and SHIFT+Other Letters (not good)
also,
How can we check to see which key was pressed anytime in the Form ? arrow keys don't trigger in the TextChanged