|
Thanks for that info James and Mazdak!!! pointed me in the right direction.
Anyway for anyone who is still having problems displaying XP style controls. i found the following site on msdn useful.
http://msdn.microsoft.com/library/?url=/library/en-us/dv_vbvcstechart/html/vbtchUsingWindowsXPVisualStylesWithControlsOnWindowsForms.asp?frame=true
Kenbloke
|
|
|
|
|
hi,
I'm new to C#,I have this problem and would apriciate if someone would give me an idea .
I have a object initilazed in a Windows form and i wold like to use the same oject in some components and the way I was thinking was to get the address of this object. But since it's a managed object the compiler doesn't alow me to take it's address.
Please give me any ideas to overcome this,
thanks a lot for your time
Endri
|
|
|
|
|
Like this:
SomeObject obj = new SomeObject();
Component1.Prop1 = obj;
Component2.Prop2 = obj;
All objects are refered to through "object references". You can freely pass this object reference to any part of your system.
--
Peter Stephens
|
|
|
|
|
Ok, quick question here -- I have VS.NET Beta 2 .. I've decided to start to get into C# and don't know much about it yet. Should I be using VS.NET Beta 2 or should I uninstall Beta 2 and install the latest release of the .NET Framwork SDK with the V1 of C# (since the C# language namespaces and the like have been re-arranged, I'm thinking that I should avoid learning the already outdated version).
On another note -- does anybody have the V1 C# compiling in their Visual Studio 6 IDE? If so are there some step-by-step instructions for implementing this?
Thanks in advance to all who reply,
Travis D. Mathison ---
--- After three days without programming, life becomes meaningless ...
|
|
|
|
|
I've started c# recently,and I use latest version of it,but the book I use for it is for Beta2 time.Up to now there were no problem and there is no difference.
I know that lots of namespace and ... changed from Beta1,not from Beta2
Mazy
You can find a solution (even a foolish one) for all problems (even big ones)
|
|
|
|
|
Ok, thanks .. I wasn't sure how much change there was between the Beta2 and V1 conversion, but apparently not as much as I thought.
Travis D. Mathison ---
--- After three days without programming, life becomes meaningless ...
|
|
|
|
|
Yes,I think for begining,it is not necessary to upgrade
Travis D. Mathison wrote:
--- After three days without programming, life becomes meaningless ...
nice
Mazy
You can find a solution (even a foolish one) for all problems (even big ones)
|
|
|
|
|
Hi all,
I've a problem with Interoperability with Win32 unmanaged code; my C# program call an unmanaged function in a Win32 DLL and pass a pointer to delegate. This DLL every 20 milliseconds call my C# delegate but the win32 thread finish immediatally after createted. In the win32 function there is one FOR cycle that print a string in output debugger window.
Can you have some suggestion for solve my problem ?
Thanks
|
|
|
|
|
In PrintDialog I changed the "AllowSomePages" to "true".
How can I determine the maximum page number?
Mazy
You can find a solution (even a foolish one) for all problems (even big ones)
|
|
|
|
|
I have a form when I resize the form the size of two text box in it change ,but I don't want it(the others do not change)
thanks
Mazy
You can find a solution (even a foolish one) for all problems (even big ones)
|
|
|
|
|
Look at the Anchor property on the two textboxes. When a form is resized it will resize so that those edges (specified by the Anchor property) are always the same distance from the edge of the container.
HTH,
James
Sonork ID: 100.11138 - Hasaki
"Not be to confused with 'The VD Project'. Which would be a very bad pr0n flick. " - Michael P Butler Jan. 18, 2002
|
|
|
|
|
I examine different Anchors for these "Multiline TextBoxes" but each time they move or resize wrong and hide other controls in the form.
Mazy
You can find a solution (even a foolish one) for all problems (even big ones)
|
|
|
|
|
To keep a control from moving, the Anchor property should be set to (AnchorStyles.Top | AnchorStyles.Left)
This will ensure that the control remains the same distance from the left and from the top.
HTH,
James
Sonork ID: 100.11138 - Hasaki
"Not be to confused with 'The VD Project'. Which would be a very bad pr0n flick. " - Michael P Butler Jan. 18, 2002
|
|
|
|
|
Thanks James,I found it
Mazy
You can find a solution (even a foolish one) for all problems (even big ones)
|
|
|
|
|
One thing that always have confused me is why is the syntax "public class MyCLass" in C#?
What does it mean that "public" in the beginning of a class?
------------------------------
©0d3 ©®4©k3® - That's me!
------------------------------
|
|
|
|
|
"public" is contrasted with "internal".
public classes can be accessed outside of the assembly that contains them. internal classes can only be accessed by other classes in the same assembly.
--
Peter Stephens
|
|
|
|
|
I have written some code in C# and I can't understand why it behaves the way it does.
It is supposed to retrieve the number of seconds that the computer has been turned
on and it looks like this:
PerformanceCounter thePerfCounter = new PerformanceCounter( "System", "System Up Time" );
float systemUpTime = thePerfCounter.NextValue( );
The thing is that it always returns 0.0 and I am pretty sure my computer has been up
for longer than that...
If I call NextValue() a second time it returns the correct uptime though. Does
anyone have any idea why it behaves like this?
thanks for the help
/Mike
|
|
|
|
|
From the docs.
Note If the calculated value of a counter depends on two counter reads, the first read returns 0.0.
My guess is that the uptime counter requires two reads
James
Sonork ID: 100.11138 - Hasaki
"Not be to confused with 'The VD Project'. Which would be a very bad pr0n flick. " - Michael P Butler Jan. 18, 2002
|
|
|
|
|
Yes, I have read that note, but it does not make any sense. Why should I have to read a counter twice to get the system up time??
A related question: I am trying to write the same program in managed C++ but the System::Diagnostics namespace does not contain the PerformanceCounter class. Why? Shouldn't the class library be identical beetween the languages?
thanks for the help
/Mike
|
|
|
|
|
I found the solution to my managed C++ problem. I had to add a
#using <System.dll>
to the program. Stupid newbie mistake...
|
|
|
|
|
Hello. I am building a custom web control, and I need to render child controls which are passed as literal strings. I am using ParseControl for this. However, it doesn't seem to be working. When I compile my custom control I get "CS0118 System.Web.UI.TemplateControl.ParseControl denotes a method where a class was expected". My code looks like: this.Controls.Add(new LiteralControl(new System.Web.UI.TemplateControl.ParseControl("<asp:textbox id=\"txt\" Text=\"Person\" runat=\"server\"/>"))); I tried just ParseControl as apposed to System.Web.UI.TemplateControl.ParseControl but when I used ParseControl I got the error "No class or namespace named ParseControl in MyControl, (are you missing an assembly reference?)" But I have System.Web.UI imported into my class. I don't know what to do. Any help is very greatly appreciated.
|
|
|
|
|
ParseControl is a method of TemplateControl which is an abstract class that Page inherits from. You use ParseControl when you want to add a new ASP.NET server control to the page.
void Page_Load(object sender, System.EventArgs e)
{
Button myButton = (Button)ParseControl("<asp:button runat = \"server\"/>");
myButton.Text = "Hello World!";
Controls.Add(myButton);
}
A literal control is used when you wish to insert HTML into your page, not ASP.NET server controls.
If you want to put HTML in your website, use Controls.Add(new LiteralControl(myHTML));
If you want to add a new server control (all server controls have runat="server" in the HTML for them) use the first code example.
HTH,
James
Sonork ID: 100.11138 - Hasaki
"Not be to confused with 'The VD Project'. Which would be a very bad pr0n flick. " - Michael P Butler Jan. 18, 2002
|
|
|
|
|
Thanks alot, but that's not really what I was trying to do.
You see, I'm getting this string for the ASP.NET web controls from a DB. They are dynamic. I don't know wether they will be buttons, labels, dropdownlists, or what.
I am trying to use ParseControl on that literal string. The literal string is the actual code of the ASP.NET web controls, not references to instantiate them or set their properties.
Does that make sense now? I have to find out how to use ParseControl in that sort of instance.
Thanks alot.
|
|
|
|
|
ok, i think i see what you're doing.
In the Page_Load event
Controls.Add(ParseControl(stringFromDB));
You'll have to set all your properties for the control in the string coming from the DB ie <asp:button id="button1" text="push me">
In general you use LiteralControl for static HTML, use ParseControl when you are creating a server control.
HTH,
James
Sonork ID: 100.11138 - Hasaki
"Not be to confused with 'The VD Project'. Which would be a very bad pr0n flick. " - Michael P Butler Jan. 18, 2002
|
|
|
|
|
I'm using the code you provided above, but it still does not work. I'm not doing this in an ASPX page. I am calling ParseControl in a custom web control source (.CS file), that's being compiled into an assembly. And when I compile the assembly, I get the error:
"ParseControl does not exist in the class MyControl"
so I reference it explicitly:
Controls.Add(System.Web.UI.TemplateControl.ParseControl(stringFromDB);
When i compile the assembly I get:
"CS0120: An object reference is required for the nonstatic field, method, or property 'System.Web.UI.TemplateControl.ParseControl(string)'"
I've got to find out how to solve that.
Thank you for all your help.
|
|
|
|