|
Hello!
In C++ we could declare a function like this:
BOOL CSomeClass::SomeFunction(BOOL bSomeParameter) const;
The 'const' meant that the function doesn't change any member variables in the class (CSomeClass). Is there an equivalent keyword in C#?
Thanks in advance and best regards,
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Nope - nothing on offer anything remotely like that, sorry.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I was thinking about the very same thing a few days back. Any idea *why* it was dropped in C# though?
Somebody told me it was dropped because C# doesn't separate the declaration (.h files) from the implementation (.cpp files), but it doesn't sound very convincing. After all, I might want an abstract class' subclasses to be able to use a parameter that is passed to a virtual method, but not modify it.
In fact, I found myself in that situation. I ended up re-designing the classes.
I'd be grateful if you can provide a convincing answer.
Cheers,
Vikram.
I don't know and you don't either.
Militant Agnostic
|
|
|
|
|
C# contains very little const support, it's something I've been lobbying for, for some time. I think it's got to do with keeping things simple, something the C# team assure me they will continue to do, although I've presented the opinion that the language often times treats the programmer as an idiot.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Ahem, so it can't be done? No clever hacks? I'm starting to miss C++.
I want my class' subclasses to be unable to modify a parameter passed to a virtual method they derive from my class.
Will my subclasses be free to run amok?
Cheers,
Vikram.
I don't know and you don't either.
Militant Agnostic
|
|
|
|
|
The problem is that in the C# treats const much more "seriously" than C++. In fact a problem common in C++ code is accidently casting away something const by shifting to a reference.
Look at the behavior of the keyword sealed. <code>sealed can protect a lot of things from having the inheritor from overriding, modifying, etc base class behavior.
|
|
|
|
|
Tom Larsen wrote: The problem is that in the C# treats const much more "seriously" than C++.
I'm still new to C#, but I don't understand the basis of your statement. Could you please explain in greater detail?
Tom Larsen wrote: sealed can protect a lot of things from having the inheritor from overriding, modifying, etc base class behavior.
Yes, but unfortunately my base method was abstract, so there's no question of sealing it.
Cheers,
Vikram.
I don't know and you don't either.
Militant Agnostic
|
|
|
|
|
The C# compiler does not provide support for this construct which was dubious in C++ anyway.
|
|
|
|
|
Hello all. I have installed vs2005 (on a different machine) and opened up a 2003 C# project (pocket pc app). it gave me the message about having to convert the project and said it did it with no problem. However, I still only have access to the 1.1 framework .net classes. Even when I go to add references, it shows the references for 1.1.4xxx or something like that. How can I point my project to look at the 2.0 framework? Specifically, I need to use the serialPort control, and it's not available before 2.0. If I start a brand-new smartdevice app, the control is listed in there with no problem.
My Music | My Pics | My Articles
BlackDice
|
|
|
|
|
Hi.
I'm developing a small aplication that runs in the startbar (using band bars). The problem is that it wont render the background as the XP themed startbar background (when I ise clasic style, it shows fine, but when I use Luna or anything else, it shows as it did on the classic style). So basicly it is an ugly gray rectangel in the middle of my statbar.
My theory is that I need to get the bitmap of the taskbar from the current .msstyle theme, and use it as the background for the aplication. I've seen some superficial tutorials in how to do this, bu they are in C++ and VB, and, I'm embarased to say, I can't understand what they are doing.
Any help would be apreciated.
|
|
|
|
|
Basically, you will need to interop the themes calls in C#, www.pinvoke.net will show you how. Then, you actually ask the themes API to draw the background, it does the drawing, it does not return a bitmap.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi,
I'm sorry if this is too easy
I want to format a double value in the format of 0.##########E##.
I need that the value start with a 0, with the exponent properly adjusted.
For example, the value 405 should be formatted as 0.405000000000000000E+03 .
If I use {0:0.000000000000000000E00} the value shows up as 4.050000000000000000E+02 .
Any way to do this?
Thanks
|
|
|
|
|
I have a database app, i don't use multiple threads in the application; i just use one database connection open for the app life time and close it at the end. One thing i notice is then longer the app is active executing i see Threads exiting in the out put window, i dispose every SqlCommand & SqlDataAdapter after using. I wonder from where these threads are comin from ???
|
|
|
|
|
Hi,
How do do I animate the movement of a simple shape (a ball) across the
client area? --thanks
|
|
|
|
|
Easiest way - an animated gif. Drawing it yourself, set a timer, and draw the frames in WM_PAINT.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I am facing problem with my custom control. Please help urgently.
My control inherits a Windows.Forms.Panel control. I have set the AutoScroll property of the base control (panel) to true. I added a PictureBox in the at location (Left = 0, Top = 0) in the panel control. Size of the PictureBox is large enough to show the ScrollBars for the base control (panel).
In the Paint Event handler of the picture Box I am drawing a rectangle.
To scroll (make it visible completely in the Client area) to the drawn rectangle, I added a transparent Label control and set its bounds(location, size) as of drawn rectangle in runtime after drawing the rectangle and called the Panel's ScrollControlIntoView method.
Scrolling works, but when I change the location and size of the rectangle to draw it to another location, the rectangle intersects the client rectangle of my control (i.e. not visible completely in the client rectangle).
How can I avoid it?
How do I know if my rectangle is intersecting the client rectangle?
Or
How do I position my transparent label such that it is completely visible in the client rectangle?
Or
Suggest me any other way
Thank You,
Gulfraz Khan
|
|
|
|
|
how can i implement the zoom over a picturebox?
And over custom controls?
|
|
|
|
|
|
Hi I have a web application where a user downloads a file(eg word doc) from a db, makes changes on the file. My question is, how do I get the edited file reuploaded into the db. Filename left intact.
|
|
|
|
|
You need to provide a file browser control ( they need to browse to the file and select it, then click on a button to upload ).
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi Christian. Thanks for your response. I'm talking about files that have previously been uploaded.
To clarify myself, the file is retrieved from the db, and written using the ffg line of code:
Response.Clear();
Response.ContentType = FILE_TYPE;
Response.OutputStream.Write(FILE_IMAGE,0,FILE_IMAGE.Length);
Response.AddHeader("Content-Disposition", "attachment;filename=" + FILE_NAME);
Response.End();
My question is, once the user makes changes to the displayed file, how do you reload the edited file into the db?
|
|
|
|
|
Even though the file comes from you, unless the user requests the file to be uploaded, I know of no way for IE to send the file back up again, even though it is running Word in the browser.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I have a listview with resizable columns that may potentially be wide enough to require a horizontal scrollbar. When I periodically refresh the contents of the lv it's position is always reset with the scrollbar shifted to show the leftmost part of the list. I want to keep the scrollbar position where it is, so that if the user is looking at items at the extreme right of the list they won't have to move the scrollbar after the update. Looking through the properties of the listview class I didn't see anyway to access this value.
|
|
|
|
|
Can anyone tell me either
a) how to find the user of a process
or, failing that
b) how to find the currently logged in user
with .NET1.1 under Windows 98 without WMI.
Dave
|
|
|
|
|