|
Thank you! I can add a new control but i can't set the properties for the control. this is my code:
TextBox tb = new TextBox();
this.Controls.Add(tb);
this.tb.Location = new System.Drawing.Point(150, 100);
this.tb.Multiline = true;
this.tb.Name = "textBox2";
this.tb.ReadOnly = false;
this.tb.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.tb.Size = new System.Drawing.Size(168, 32);
this.tb.TabIndex = 1;
this.tb.Text = "textBox1";
this.tb.Visible = false;
It gives errors. How to set the properties on the control?
|
|
|
|
|
What errors are you getting?
From what I see that code is fine; though I don't think it matters can you try psetting the properties before you do the 'this.Controls.Add(tb)'?
James
Sonork ID: 100.11138 - Hasaki
"My words but a whisper -- your deafness a SHOUT.
I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
Ok, i got it ! I am not suppose to put
'this.tb.Location(....)'
but this:
'tb.Location(....)'
ok... Thank you very much!!
thongkk
|
|
|
|
|
lol, I can't believe I missed that! At least you have it figured out now
James
Sonork ID: 100.11138 - Hasaki
"My words but a whisper -- your deafness a SHOUT.
I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
I would guess
Container.Controls.Add(new Control());
without having tested it yet
*woops, didnt notice the earlier post agreeing.
|
|
|
|
|
Hi !
Did anyone know an article who describes "how to install and starts a windows service remotely." I would like to implement such a function in C#.
Thanks in Advance
:confused
|
|
|
|
|
I'm trying to figure out if there's something wrong with my system or if it's normal. I don't remember it being this slow before.
I made a very small console app that opens a text file, writes one line to it and then reads that line back and prints it to the screen. It takes 22 seconds to run. The system is a pIII 700 with 256 megs of ram running win2K. I'm pretty sure that with the beta framework's small console apps ran at a reasonable speed.
Is this normal or is there something wrong with my installation?
|
|
|
|
|
that certainly sounds like its way too long; even with the JITing. Just to be sure though run ngen on your exe, then time it again. ngen will pre-JIT so the only startup time will be loading the framework.
HTH,
James
Sonork ID: 100.11138 - Hasaki
"My words but a whisper -- your deafness a SHOUT.
I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
Uninstalled and reinstalled the framework and it's fixed. takes only a couple seconds to fire up the first time. Pretty much instant the second time.
|
|
|
|
|
I have a label and I want to change the font style to bold or italic programmically.Can anybody tell me the code?
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
Based on ASP.net work (it may not be the same)
Object.Font.Bold = true;
Object.Font.Italic = true;
Object.Font.Name = "verdana";
etc.
// Rock
|
|
|
|
|
I used this code but there is an error return for it:
E:\....(106): Property or indexer 'System.Drawing.Font.Bold' cannot be assigned to -- it is read only
Any suggestion?
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
ok, I fired up a winforms project and I have no idea. The property is listed as get only in code, but is settable in the designer.
// Rock
|
|
|
|
|
Most of the properties on a Font are read-only; you have to create a new font object and assign it to one you wanted to change.
James
Sonork ID: 100.11138 - Hasaki
"My words but a whisper -- your deafness a SHOUT.
I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
Sorry James,Could you give an example?
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
Mazdak wrote:
Sorry James,Could you give an example?
Certainly
Font newFont = new Font(myLabel.Font,
FontStyles.Bold | FontStyles.Italic
);
myLabel.Font = newFont;
If you want to change more than the font style you'll have to extract all of the needed properties from your old font and pass them to the constructor to the Font class.
ms-help://MS.NETFrameworkSDK/cpref/html/frlrfsystemdrawingfontclassctortopic.htm
The url above is for the .NET documentation; putting you right at the constructor list; since there's way too many for me to want to type
James
Sonork ID: 100.11138 - Hasaki
"My words but a whisper -- your deafness a SHOUT.
I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
Thanks,I'll check it
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
There is a little mistake here James,you should use singular 'FontStyle';)
Thanks again
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
Mazdak wrote:
you should use singular 'FontStyle'
Oh man, today isn't my day! Earlier this morning I made another mistake in the data class thread.
Maybe thats a sign that I should go to sleep!
James
Sonork ID: 100.11138 - Hasaki
"My words but a whisper -- your deafness a SHOUT.
I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
Hi All,
I am currently creating an application that needs to populate a number of arrays and then I need to be able to call them again in different parts of the application.
At the moment I have figured out how to Populate an array if I know how many items I am going to have but how do popualte and array when I don't know how many items there are.
And How do I find out how many items there are in an array once it is populated?
This is what I have at the moment
====================
string[] ClinicNames;
ClinicNames = new string[99];
int j = 0;
while (dReader.Read())
{
ClinicNames[j] = dReader.GetString(1);
j = j + 1;
}
====================
|
|
|
|
|
To find the length of an array, use the Length property:
String[] arr = new String[5];
Console.WriteLine("The array length is {0}.", arr.Length); When you exceed the capacity of your array, you will have to allocate a new array and copy the contents of the old array to the new. You can automate this process by using the System.Collections.ArrayList class which will resize the array when necessary.
--
Peter Stephens
|
|
|
|
|
OK, As I understand AxHost wrapper will allow you to embed ActiveX controls inside C# Container...
Do you know of anything that will do the contrary => allow to embed C# Sharp Control into C/C++ Container...
Thnx...
|
|
|
|
|
I read that there was support for exposing C# controls as ActiveX in early betas, but that feature was dropped before (at least) RC1. Sorry.
--
Peter Stephens
|
|
|
|
|
As I understand cumbersome case, would be to write my own wrapper...
I'm thinking that maybe idiotic, but still valid solution would be to create instance of WebBrowser, persist it with <object> tag that has dynamic CLSID of corresponding C# Object... After that enumerate DHTML and extract IDispact of that <object> element... Very possible... But, Isn't that crazy???
Strange those "young inventors" or "gurus" are forcing us to reinvent the bycicle??!!!... However, solution is there => I hope they don't have plans to rewrite WebBrowser on C# (even on C it's still pretty slow considering DHTML realtime rendering)...
Wow, what a bunc of IDIOTS!!!...
Or maybe we both don't understand something!!!...
|
|
|
|
|
Hi,
I’m trying to implement drag & drop (explorer like application) in my application using C#.
appreciate some guidance on this.
Thanks
|
|
|
|