|
Hi,
Can you tell me that how can I prevent a C++ class from being inherited by any other class. In C#, we have the keyword "sealed" and "final" in Java.
Do we have any keyword in C++ to avoid inheritance for a class?
Regards,
shankar.
SRI SANKARADOSS.
|
|
|
|
|
There's no such word, but there is a workaround:
- Make the constructor(s) private
- Add a public static method to return a new instance of the class.
Regards,
Alvaro
Hey! It compiles! Ship it.
|
|
|
|
|
Hi everybody,
as You may know there are avaible two versions of UDDI registers. Microsoft implemented both and developped kits (UDDI SDK). In my application I use such kit to interact with UDDI register. I must decide at write-time to which one I add reference. But I want to decide about it at run-time because some of registers work with both UDDI versions and some don't.
Any suggestions?
thanks for help
Lukas
|
|
|
|
|
I like to start a program (exe-file) with an object I pass to. Both programs, the caller and the called are written in c#. Any ideas?
|
|
|
|
|
|
As suggested, I also think that it "smells" like a bad design. Unless you have strong motivations, you should change the design, and make a shared DLL used by the two programs.
But, assuming you already exhausted this option, and can't change the design, you easier options are:
a. You can serialize the object to disk or to a socket, so the second process can deserialize it.
b. You can use remoting and pass the object to the second process.
If your object is small (< 128 bytes), you could also make a string representation of it (or serialize it to a base64 stream) and pass the resulting string as the command line argument.
You can do it on anything you choose - from .bat to .net - A customer
|
|
|
|
|
Hi. I want to implement a program that sends 1 as a numerical value if a checkbox is checked and zero otherwise. So I read MSDN.
I read from MSDN that:
"The Boolean class implements true as the integer, one, and false as the integer, zero. However, a particular programming language might represent true and false with other values. "
I did this in C#:
Checkbox1.checked.GetHashCode();
I get the 1 and 0. But is this safe? I'm worried about the part where it says "However, a particular programming language might represent true and false with other values. " I'm afraid this might cause any side effect. Any ideas what Hashcode is?
"To teach is to learn twice"
|
|
|
|
|
|
when it says some languages represent it different, most, frmo my experience, either follow the C# convetion or use 1 to represent true and 0 or less as false (e.g. C). You can easily convert bools to ints using Convert.ToInt32(value) .
However Convert.ToBoolean will acturately convert 1 to true and 0 to false, but when i tried it, converted -1 to true.
|
|
|
|
|
freshthinking wrote:
0 or less as false (e.g. C).
Whoa there! In C (and most other languages), false is 0; anything that is not zero is considered true. That is why -1 was converted to true when passed into Convert.ToBoolean.
James
At Jethro Tull's August 28, 2003 concert Ian Anderson mentioned that the group would be performing a medley of title tracks. The songs were "Songs from the Wood", "Too Old to Rock and Roll; Too Young to Die"; and from the Heavy Horses album, "Stairway to Heaven".
|
|
|
|
|
Exactly. Amazing how people get confused by 'bool'
But wait, what the heck is the connection between GetHashCode and bool? Is the original poster insane or is it me?
|
|
|
|
|
I think the original poster was just looking for something on the Boolean class which returned an int, and GetHashCode just happens to do that.
I've replied with what I hope we can agree is a better way of doing what was wanted.
James
At Jethro Tull's August 28, 2003 concert Ian Anderson mentioned that the group would be performing a medley of title tracks. The songs were "Songs from the Wood", "Too Old to Rock and Roll; Too Young to Die"; and from the Heavy Horses album, "Stairway to Heaven".
|
|
|
|
|
Actually, m not goin insane. hehhe. I was actually looking for a way to convert the boolean method without resorting to using Convert. Anyway, m just exploring C#. Thanks anyway!
|
|
|
|
|
daljv wrote:
Any ideas what Hashcode is?
GetHashCode is used to provide a value called a 'hash' for classes like System.Collections.Hashtable . These classes use that value to create a collection which can grow but still retain a fast look-up to get the proper value. A hash table is also called a Map by some people because you can map one value on to another.
For example, you can use a Hashtable to map a string representing the name of a customer onto an object that contains more information about that customer. Hashtable internally calls GetHashCode on the string so that it can find the customer object quickly.
Rather than calling GetHashCode on the Checked property you could just use the ?: operator.
Checkbox1.Checked ? 1 : 0;
That basically expands out to,
if( Checkbox1.Checked )
return 1;
else
return 0; HTH,
James
At Jethro Tull's August 28, 2003 concert Ian Anderson mentioned that the group would be performing a medley of title tracks. The songs were "Songs from the Wood", "Too Old to Rock and Roll; Too Young to Die"; and from the Heavy Horses album, "Stairway to Heaven".
|
|
|
|
|
Hi, I have a problem:
I have an .NET application that uses Crystal Reports as reporting tool. I need to filter records. The problem is that I have just dataView.RowFilter string but Crystal reports do not accept it becouse they have their own syntax for selecting records.
Is there any way i can give normal MS SQL syntax string to filter records? (I mean where clouse)
Or I need to create translator from SQL syntax to Crystal syntax?
Do not offer to use ADO.NET datasets, they work very slow.
Thanx
|
|
|
|
|
MMm.... well you can set that DataView in a new DataTable, and pass it as parameter to the Report as a dataset parameter.
HTH
Braulio
|
|
|
|
|
You can't use a DataView as a datasource. It's supposed to work, but my
contact at Crystal told me that there is a bug in the current release that
doesn't let it connect properly. Hopefully they will fix this in a future
release. If you want to see all the ways you can connect a datasource to a
report then check out Chapter 14 of my free online ebook.
-----------------------
You are right. CR works with datasets, but not dataview. I discovered this
while working on my book and discussed it with tech support. They worked on
it and decided that there must be a casting error in their code and they
created a KB issue for it. Hopefully it will be fixed in a future service
pack.
|
|
|
|
|
Hi guys,
Created a simple asp web app and compiled it fine and runs the web page.
So I dragged a label over and placed it on the form. In load_page put the code:
label1.Text = "This is a test web page";
But when its run, it doesn't display the label!!
What am I doing wrong??
Thanks.
|
|
|
|
|
Hi,
Is it possible to get the event of scroll of a Form? I would like to do something every the forms is scrolling; (the form is set to AutoScroll).
Thanks for help~~!!
|
|
|
|
|
Scrolling support in WinForms is not too good. You have to subclass the form and catch WM_HSCROLL, WM_VSCROLL, and WM_MOUSEWHEEL events.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
jdunlap wrote:
You have to subclass the form
sorry,jdunlap,
I'm stupid.Could you explain it a bit more?
Coz I'm just a fresh C# programmer. I'll be happy if you could provide me some part of codes/examples.
Thank you
|
|
|
|
|
Here is a basic subclassing class in C#:
class SubClasser : System.Windows.Forms.NativeWindow
{
public SubClasser(IntPtr formhandle)
{
base.AssignHandle(formhandle);
}
protected override void WndProc(
ref System.Windows.Forms.Message m)
{
base.WndProc(ref m);
switch(m.Msg)
{
case WM_HSCROLL:
break;
case WM_VSCROLL:
break;
}
}
}
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
jdunlap wrote:
Scrolling support in WinForms is not too good.
If the scrolling is not good in WinForm, then what can I use? Or I need to make a newcontrol?
I use autoScroll in my Form, because I don't want to waste much time on calculation. I've tried to use hScrollBar and vScrollBar, but the interface looks not beautiful as autoScroll bar.
Any idea for me??
|
|
|
|
|
I have a class library version 1.0. I want it to GAC(Global Assemly Cache).Now how can I use it in my application?I can't use object which exist in it,I have to first Add reference to the local compy of it,then if I delete dll file in my debug directory,because another version is exist in GAC I can use the version in GAC.HHow can I use that vversion from the begining.
My second question is I have careated version2.0 and v3.0 and put them in GAC,the question is how can I force my application to use my desired version?
Mazy
No sig. available now.
|
|
|
|
|
Regards,
We have developed a multimedia software using C# which uses a .mdb (MS-Access file) as database. When burning the whole project on the CD, the program coulden't access the database so we had to to install the .mdb file on the user's system HDD and that works.
But I still wonder why it was not possible to read our database on the CD and if it is anyway to do so. perhaps C# needs to write some temporary files beside the .mdb file to work with or what?
Thanks for any note and help,
-nSun
---
"Art happens when you least expect it"
|
|
|
|