|
leppie wrote:
Your method also fails to consider that text might be selected in the RTB, so much more work to handle that, now add some color and threads, and you have a nice mess.
Yeah, you're right. But how am I supposed to know if that's required? I guess that's the whole point here. You contributed a solution, I contributed a solution. Yours is a general purpose one. However it depends on Win32 API calls (and therefore isn't platform-independent... yeah, I know... I don't know if that's required either ). Mine has some drawback with complex states of the RichTextBox. But following the Simplicity XP rule[^] (as well as the KISS principle[^]) ScrollToCaret() would still be my first suggestion. If it turns out not to meet the requirements it has to be re-written. You see, if one starts with the more complex solution and it is unnecessary someone might replace it during refactoring anyway (following the Refactor Mercilessly rule[^]).
Best regards
Dennis
|
|
|
|
|
Hello,
My app has 2 methods closing a form. By menu "Exit" and the "X" on the upper right. How can I check, if the "X" Button was clicked and not the menu item "Exit" ?
|
|
|
|
|
May be dull but easy ,
Put a flag for your menuItem which will be set to one by menuItemClick event and directing the call into two methods by checking the flag.
Have a nice day
|
|
|
|
|
Yes dull but easy - (works).
Finally, there must be a way to check this by EventArgs or by sender in the Closing Event ( Property or whatever )
|
|
|
|
|
Do you know some TOM (Text Object Model used by RichTextBox) class for C# ?
Thank you
Wizard_01
|
|
|
|
|
Hi
I got an access database.
is it possible to put the tables of this database in a combobox?
If yes then how?
the underdog
|
|
|
|
|
Hi
Use the following snippet for retrieving table names....
OleDbConnection connection = new OleDbConnection(<connetcionstring>);
connection.Open();
object[] restrictions;
restrictions = new object[] {null , null , null , "TABLE"};
DataTable table;
table = connection.GetOleDbSchemaTable(OleDbSchemaGuid.Columns,restrictions);
connection.Close();
then,
this.cmbTables.DataSource = table;
this.cmbTables.DisplayMember = "TABLE";
I hope it works for you.
|
|
|
|
|
First of all get rid of the new table names stuff and check if you can read data from the tables by using your OleDb code.
Fill some sample data in Access and use
..
.
.
.
.
string sqlSelectStatement = "SELECT * FROM <tablename>";
OleDbDataAdapter adapter = new OleDbDataAdapter =(sqlSelectStatement,connection);
connection.Open();
DataTable table = new DataTable();
try
{
adapter.Fill(table);
}
connection.Close();
Now look in table and tell the result.
|
|
|
|
|
I get the containment of the Table.
So that works as it should
But how to go on now?
The underdog
|
|
|
|
|
If your OleDb code work then as you did last time,
comboBox1.DataSource = table;
combobox1.DisplayMember = columnNameYouWantToListInTheTable as string;
should work.
I dont know what the column name is.
Try some possibilities.
Sorry for incomplete help.
|
|
|
|
|
Hi...
I have some text i want to add to a string!
The text would look like this:
<?xml version="1.0" encoding="utf-8"?>
But i have no idea how to do it... i would do like this:
string a = "<?xml version="1.0" encoding="utf-8"?>";
But that does not work!
Can anyone tell me how to add this to a string..?
Thanks!
QzRz
|
|
|
|
|
Hi,
Put '@' character before the string to inhibate the effect of inner quotes.
string a = @"";
To add a string to another use
String.Concat(string str1 , string str2, .... );
These will work if I got your problem right.
|
|
|
|
|
well... it does not work...
i did this:
string a = @"<?xml version="1.0" encoding="utf-8"?>";
I am using microsoft visual studio .net 2002!
And it puts a red line under '1.0" encoding=@"utf-8"?>"' and i cannot debug!
Do you have another idea of how to solve this...?
Thanks...!
QzRz
|
|
|
|
|
Escape the quotation marks.
string a = "<?xml version=\"1.0\" encoding=\"utf-8\">";
www.troschuetz.de
|
|
|
|
|
Escape the quotation marks.
What does that mean?
do not understand:
string a = "";
QzRz
|
|
|
|
|
Sorry, i forgot to check the "Do not treat <'s as HTML tags" option.
Here it is again.
string a = "<?xml version="1.0" encoding="utf-8"?>";
|
|
|
|
|
It still gives me same problem!
Nomatter if i write:
string a = @"<?xml version="1.0" encoding="utf-8"?>";
or
string a = "<?xml version="1.0" encoding="utf-8"?>";
it still wont work...!
QzRz
|
|
|
|
|
It's definitely not my day: this time i forgot to escape the quotation marks.
Let's give it one more try
string a = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
|
|
|
|
|
that works... thanks...!
QzRz
|
|
|
|
|
Do not use quotation marks '"' for 1.0 and utf-8, you can use single quotes.
If this will be an XML file I have checked single quote before and it has worked.
|
|
|
|
|
How is it possible to pass the property name as string and get the value of the property?
Any link is also ok.
|
|
|
|
|
|
how would i add a string were the current index is(caret)??
IM PROUD TO BE A GMAIL;
|
|
|
|
|
The string class has an Insert method that takes an int specifying the index at which to insert the new string and the string to insert. TextBox.SelectionStart will give you index where the caret is currently located if there is no text selected, or the beginning of the selection if there is. You'll probably want to replace the selected text if there is any. You'd use String.Remove for that.
Charlie
if(!curlies){ return; }
|
|
|
|
|
thanks
IM PROUD TO BE A GMAIL;
|
|
|
|