|
try this :
private void button1_Click(object sender, EventArgs e)
{
System.Windows.Forms.TextBox textBox1 = new System.Windows.Forms.TextBox();
textBox1.Location = new System.Drawing.Point(81, 110);
textBox1.Name = "textBox1";
textBox1.Size = new System.Drawing.Size(100, 20);
textBox1.TabIndex = 1;
this.Controls.Add(textBox1);
}
Becoming Programmer...
|
|
|
|
|
Hi,
I have some Rich Text Control that i use as label ( im not using Static label because i need to change the color and font of some chars ) that i set to it in Run Time some String.
In case the string is too long ( the size of the Rich Text label is not auto size ( i mean that the size is const ) ) there will be some Tool Tip with the all string.
My question is ... how can i know if the string is too long ?
Is there is some way ?
Thanks for any help.
|
|
|
|
|
int stringlenght = rtb.Length;
Becoming Programmer...
|
|
|
|
|
This will bring back the string lengh of the all rich text ... and this is not what i need.
|
|
|
|
|
RTB.Text.Length would give the number of actual characters; that is good enough when
using a non-proportional font.
For proportional fonts, this may do it:
create a second but invisible RTB with AutoSize, give it the same text, read its Width,
compare with the Width you gave the original RTB and act accordingly.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
In code behind, borderstyle property is set. I want to do the same using javascript.
TextBox.BorderStyle = BorderStyle.NotSet;
Can you suggest something using
document.getElementById('<%=TextBox.ClientID%>'...?
Please help.
Thanks
|
|
|
|
|
You are in the wrong forum. This is the C# forum. Use the Web Development forum instead.
---
single minded; short sighted; long gone;
|
|
|
|
|
Not only are you in the wrong forum, but don't double-post...it doesn't help your chances of getting a useful response.
|
|
|
|
|
Sorry! Will post in the right forum.
Scott, it was not my mistake. I take great care while posting on CP. I have been here for some time.
Posted the message and refreshed it couple of times. Was sure that it didnt go through successfully and then posted again. Now, there are double ones!!!
Thanks
|
|
|
|
|
In code behind, borderstyle property is set. I want to do the same using javascript.
TextBox.BorderStyle = BorderStyle.NotSet;
Can you suggest something using
document.getElementById('<%=TextBox.ClientID%>'...?
Please help.
Thanks
|
|
|
|
|
This is a C# forum, you might want to ask in the Web Development forum.
"Try asking what you want to know, rather than asking a question whose answer you know." - Christian Graus
|
|
|
|
|
hi
I cant seem to add 24 hours onto a datetime variable.
i have a startTime value and with that i want to add 24 hours to it to get a endTime.
what i have right now is:
DateTime startTime = DateTime.Parse(Request.QueryString["LogonDate"]);<br />
<br />
DateTime endTime = startTime;<br />
<br />
endTime.AddHours(24);
startTime's value is for eg. "2007/06/01 12:00:00AM"
but its not adding 24hours to endTime variable. It stays the same as the startTime.
Please somebody help me..
|
|
|
|
|
try this instead:
DateTime startTime = DateTime.Parse(Request.QueryString["LogonDate"]);
DateTime endTime = startTime.AddHours(24);
Without checking the docs I strongly suspect AddHours returns a new DateTime instead of modifying the existing one.
--
If you view money as inherently evil, I view it as my duty to assist in making you more virtuous.
|
|
|
|
|
dan neely wrote: Without checking the docs I strongly suspect AddHours returns a new DateTime instead of modifying the existing one
Correct - DateTime is immutable.
|
|
|
|
|
Hi,
the DateTime methods return a new DateTime, they do not change an existing one,
hence you need endTime=endTime.AddHours(24);
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
As others have said, the methods on DateTime do not modify the object you have. That is because the DateTime object is immutable. That means that once it is created it cannot be changed, you have to create a new one.
Had you done the simplest of research - like read the documentation - you would have found this out. (Hint: In pretty much all windows applications pressing F1 will bring up the documentation.)
|
|
|
|
|
Perhaps his F1 key is immutable and mapped to 'Switch Weapons' or 'Strafe'. (Do games still have strafe, like the original Doom?)
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"This time yesterday, I still had 24 hours to meet the deadline I've just missed today."
|
|
|
|
|
Malcolm Smart wrote: Perhaps his F1 key is immutable and mapped to 'Switch Weapons' or 'Strafe'. (Do games still have strafe, like the original Doom?)
I doubt he's up to any game beyond Snap.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
i want to develop a simulation program that can be used to simulate the actual windows
i.e :: in the MCSE exams there is a part is called simulation questions, in these questions a window like the actual windows interface appears and you can interact with it, as if you are dealing with actual windows environment
if any one have any idea how can i design this,, i need help about this topic
many thanks
Omar Elhadad
Software Developer
omer
|
|
|
|
|
Please don't repeat your posts. This is a free site - people will respond to your original question in their own time.
Paul Marfleet
|
|
|
|
|
There may be some instances that I would load the dll library. One time that I might be using this abc.dll then later in time that I would have the application to change to different dll which would be xyz.dll. Basically that they have the methods but have very different algorithms inside there.
What's the best way for me to do that? Right now that I'm using this:
<br />
Assembly a = Assembly.LoadFrom("abc.dll");<br />
Type mm = a.GetType("abc");<br />
object o = Activator.CreateInstance(mm);<br />
object[] par = new object[] { };<br />
ds_LUT = (DataSet)(mm.InvokeMember("GetLutTable", BindingFlags.Default |<br />
BindingFlags.InvokeMethod, null, o, par));<br />
<br />
<br />
<br />
Is there a way to keep the dll open until I am "finished" with it so I can close it and open the other dll? That will be done during runtime.<br />
<br />
Additional note: The dll are in c# language and was created in Visual Studio.Net 2005 software.
|
|
|
|
|
Without getting into additional app domains, once the DLL is loaded you will not be able to unload it. You can load more than one DLL at a time, so the idea of needing to "close it and open the other dll" doesn't really apply.
|
|
|
|
|
The only way to do this would be to have the DLL loaded into a separate AppDomain, which you could then unload. Mind you, I don't see what benefit this would bring you, as the Type would be completely different when you load up the new DLL - even if they have the same name, they really are different types so you won't have to worry about implementation collisions.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
How about letting the types within the assemblies inherit a given interface?
Then cast the instances to the interface on creation and the methods will be the same, but the implementation in the various types will differ.
-Larantz-
|
|
|
|
|
Hi........
The error is ...System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: index
My code is like this.........
phInfo is a PlaceHolder
ptoInfoData.InfoRow[] infoRow = GetInfoRow();
for (int i=0; i < infoRow.Length; i++)
{
if (! smInfoId.Contains(infoRow[i].info_id))
{
//did some coding here
Control ptoInstance = LoadControl@"~\Controls\bnInstance.ascx");
HERE NEAR THIS LINE THAT ERROR IS COMMING
this.phInfo.Controls.AddAt( i , (ptoInstance));
}
}
Thanks in advance....
|
|
|
|