|
It's not a bug. It's documented in the TextBoxBase class that TextBox and RichTextBox inherit from. In order for ScrollToCaret to work, the control must have the focus.
Remarks<br />
This method enables you to scroll the contents of the control until the caret is within the visibile region of the control. If the caret is positioned below the visible region of the control, the ScrollToCaret method will scroll the contents of the control until the caret is visible at the bottom of the control. If the caret is positioned above the visible region of the control, this method scrolls the contents of the control until the caret is visible at the top of the control. You can use this method in a multiline text box to ensure that the current text entry point is within the visible region of the control.<br />
<br />
Note This method has no effect if the control does not have focus or if the caret is already positioned in the visible region of the control.<br />
Docs on TextBoxBase.ScrollToCaret Method[^]
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
thank you for the help. , it works now.
|
|
|
|
|
IIRC, calling AppendText() seemed to do that automatically.
Regards
Senthil
|
|
|
|
|
Regardless of whether AppendText() really scrolls to the end (I don't know if it does), everybody should be careful when using this function!
There's another bug (introduced in .NET 1.1 IIRC) that limits text in a TextBox to 32K, no matter what the MaxLength property is set to, when text is appended via AppendText() !
Using textBox1.Text += "NewText"; instead works as expected.
You can try it:
TextBox tb = new TextBox();
tb.MaxLength = 0;
tb.Text = new string('0', 32767);
tb.AppendText("12345");
System.Diagnostics.Trace.Assert(tb.Text.Length == 32767+5); This will throw an assertion every time.
I came across this bug when I had written a program to concatenate many texts and didn't notice at first, until my colleague told me that ~500KB of text concatenated only gave a 32KB file, although I had explicitely set MaxLength to 0.
mav
|
|
|
|
|
thank you, it already works with scrolltocaret() and focus()
|
|
|
|
|
The code I posted above does exactly what you are looking for, its clean and simple, I dont understand why ppl wanna mess different fucntionality. Also my version does not need focusing, and it works with wordwarp, and it handles resizing of the control.
top secret Download xacc-ide 0.0.3 now! See some screenshots
|
|
|
|
|
i'm bad enough at trigonometry without having to code it
cosine rule is: b2=a2+c2- 2bccosA
so: cosB=a2+c2-b2/2ac
B=cos^-1(cosB)
I'm having problems coding the last line,'cos^-1',any help appreciated
|
|
|
|
|
|
my code looks like this,'A' should come out at about 70 degrees
double sideA=6.75;<br />
double sideB=4.5;<br />
double sideC=6.7;<br />
<br />
double cosA=(Math.Pow(sideB,2) + Math.Pow(sideC,2) - Math.Pow(sideA,2)) / (2 * sideB * sideC);<br />
tried double A=Math.Acos(cosA);
|
|
|
|
|
And it does, if you pay attention to the information the documentation gives you.
In this case you have to multiply the return value of Math.Acos by 180/Math.PI to convert it from radians to degrees.
www.troschuetz.de
|
|
|
|
|
I'm trying to find the best way to accomplish this; it seems what I'm doing is far too involved.
What I'd like to have is a combo box loaded with some IDs that is used to populate a datagrid that queries off of other tables (Access). The main problem I'm having is the DataSet/OleDbCommands I'm using apparently don't like having a multi-table query used. The data in the data grid is going to be a simple inner join off of a few tables, so names can be displayed as opposed to IDs.
To fix this, I set up a reader, then populated a queue and used that for the datagrid. This seems like a bit much effort, so I'd rather see if there's a better way.
Here's some pseudo-code for what I'm doing -
<br />
command = "select * from tab1, tab2 where id = @id"<br />
command.parameter = @id<br />
<br />
adapter = new adapter( command )<br />
apadter.fill( dataset )<br />
<br />
datagrid.datasource = dataset<br />
<br />
- event combochange -<br />
command.parameter.value = combo.selectedvalue<br />
adapter.fill( dataset )<br />
This code works well if there is only 1 table in use, but as soon as multiple tables are involved, it doesn't work so well. I've found ways to link multiple tables through relations, but I just need a read-only grid display of the data.
Any help is very much appreciated.
----
xian
|
|
|
|
|
^^
Can anyone provide me some assistance? Thanks!
----
xian
|
|
|
|
|
Does anyone be able to enumerate all virtual directories in a IIS server with c# ?
I'm trying to use WMI for it but, until now, can't figure out how wmi works.
I will be glad to get a positive answer even to enumerate the virtual directories on a local computer but, if someone know how to make the same thing on a remote iis server, better.
|
|
|
|
|
I am about to write an application that synchronizes the outlook contacts with the shared contacts on the Exchange server. I easily connected to the outlook contacts (using interop.outlook).
now i am trying to connect to the server (using cdo) and get the shared contacts folder. okay I opend a session but how do I logon and get the contact folder later.
thanks
tim
|
|
|
|
|
I had inserted from InsertMenu->new ATL Object->Miscallenous->Dialog
Give it short name MyDialog.Then inserted Microsoft Web Browser(By Right clicking on dialog and choosing
insert ActiveX Control).Now my problem is how can i call www.yahoo.com
in the control and get Documentcomplete and events such as were user clicked.
Plz help Me
Thanks in advance
Devom
|
|
|
|
|
Since C# doesn't support ATL, you're in the wrong forum. I think your looking for the C++ Forum[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi!
We created an application that runs stable without memory leaks under windows xp. now we run the same application under windows mobile or windows ce.net wit memory leaks.
is their any way to check memory leaks while the application is running on a pocket pc?
regards, zuschauer!
|
|
|
|
|
Hello Corinna
Add a streamWriter.Flush after the streamWriter.Write .
String myObject = "my text";
MemoryStream memoryStream = new MemoryStream();
XmlSerializer serializer = new XmlSerializer( myObject.GetType() );
serializer.Serialize(memoryStream, myObject);
memoryStream.Seek(0, SeekOrigin.Begin);
StreamReader streamReader = new StreamReader(memoryStream, Encoding.UTF8);
string xml = streamReader.ReadToEnd();
StreamWriter streamWriter = new StreamWriter(new MemoryStream());
streamWriter.Write( xml );
<big>streamWriter.Flush();</big>
streamWriter.BaseStream.Seek(0, SeekOrigin.Begin);
serializer = new XmlSerializer( typeof(String) );
Object content = serializer.Deserialize(streamWriter.BaseStream);
string str = (string)content;
Console.WriteLine(str);
Regards,
Nish
|
|
|
|
|
I have developed the web service and secured it using the WSE 2.0.
Problem is client of this web service is in Delphi 6.0.
What should i do to call this web service from the Delphi client.
Thanks in advance.
|
|
|
|
|
Hello
In a windows form i have some TextBox that are binding to my Dataset. In one of my TextBox , i fill data on it, but when i go to the another TextBox ,the last data lose from previous.
How can i do !?
|
|
|
|
|
Hello
In windows forms i have some TextBox that are binding to my Dataset.I want to get the current row to set my DataRow for delete the current row.How i can do it ?
|
|
|
|
|
Hi all,
I'm trying to respond to the letter 'a' being pressed . But some how when i ran the form, this KeyPress function was not activated at all. Is there something else I need to do ? I have
this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.frmMain_KeyPress);<br />
inserted automatically already.
Please help. Does this mean that the form is no focus??? I already clicked on the form and tried typing 'a' but no messagebox shown or was did debug mode enter the source code.
private void frmMain_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)<br />
{<br />
switch ( e.KeyChar)<br />
{<br />
case 'a': <br />
MessageBox.Show("a");<br />
break;<br />
}<br />
}
|
|
|
|
|
Normally a form automatically receives all keyboard events, if it has no visible or enabled controls. But if it has controls, I think the focus is never on the form itself but always on a contained control.
Try setting the KeyPreview property of your form to true, so your form receives key events before the event is passed to the control that has focus.
www.troschuetz.de
|
|
|
|
|
Hi
I am having small problem in WMI related question.
The folowing function will accept username,password and process executable path as input parameter, and it will launch a new process in the host.and finally I will fetch Process ID and process name.
This code is working fine for the current user, that means passing username and password as null.
My requrement is I wand to run a process for a different user( with username and password)
Can any one guide me in this rehgard?
void LaunchProcess(string filename,string username,string password)
{
bool currentUser = false;
string processName = "";
uint processID = 0;
if( (username != null)&& (password != null))
currentUser = true; // LaunchProcess got username and Password.
ConnectionOptions objConnectionOptions = new ConnectionOptions();
if(currentUser ==true)
{
objConnectionOptions.Username = username;
objConnectionOptions.Password = password;
}
ManagementScope objManagementScope = new ManagementScope("root\\cimv2", objConnectionOptions);
objManagementScope.Connect();
ManagementClass processClass = new ManagementClass("Win32_Process");
processClass.Scope = objManagementScope;
//Get an input parameters object for this method
ManagementBaseObject inParams = processClass.GetMethodParameters("Create");
//Fill in input parameter values
inParams["CommandLine"] = filename;
// this will execute the command.
ManagementBaseObject outParams = processClass.InvokeMethod("Create",inParams, null);
// Wait for 1 Second to start the Process
System.Threading.Thread.Sleep(1000);
// Get the Unique Process ID after Process Creation
processID = (uint)outParams["processId"];
//Query based on the received processID and get the Process Name .
ObjectQuery objObjectQuery = new ObjectQuery("Select name from Win32_Process Where ProcessID = '" + processID + "'");
ManagementObjectSearcher objMagObjSearcher = new ManagementObjectSearcher( objManagementScope, objObjectQuery );
ManagementObjectCollection objMagObjCollection = objMagObjSearcher.Get();
foreach( ManagementObject objManagementObject in objMagObjCollection )
{
if(objManagementObject["name"] != null)
processName = objManagementObject["name"].ToString();
} // foreach
}
}
|
|
|
|
|
IIRC, the WMI Win32_Process class doesn't support RunAs.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|