|
|
How can I hide the Horiz scroll bar
public myClass : DataGrid
{
public myClass() : base()
{
this.HorizScrollBar.Visible = false;
}
doesnt do anything?
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
How do you indicate a default property or is that not possible and the toString is assumed?
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
There's no such thing as a default property in the same way as there is with VB(.NET or otherwise). Even ToString() isn't that. Come to think of it, ToString() isn't even a property, it's a method. I don't mean that to sound patronising, but it is an important distinction in C#.
Some functions will receive an object and use ToString() beause it's one of the few methods / properties available to everything deriving from object . But that's not the same thing as what I think you're asking about.
The function still has to call ToString() explicitly, while a VB "default property" is something used in the absense of a property. Default properties make for very confusing code sometimes (for very little gain, IMO) and C# is attempting to avoid that.
However, albeit in a completely different context, there are such things as Default Properties in C#: as in the property that is selected by default when a control is selected.
By your mention of ToString(), I don't think that's what you're looking for. If it is then I apologise and either I or someone else will explain that
Paul
|
|
|
|
|
Well my whole reasoning is that I have classes tied to a data grid and inside this class lies other objects. Is there a way I can tell the datagrid for this object I wil grab "abc" property or method?
That was myh reasoning not really a default but it pulls the
public override string ToString() method by default and thats how I synchronized the data but is there ways up specifying other properties or methods?
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
Well, this kind of thing is exactly what overriding ToString() is for: "How would you disply this object in String Format?" So a datagrid can say "I can only deal with display strings - so how has the developer told me to handle this object?".
If it works then I can't think of a single reason to try to do it another way. It's certainly not a hack, if that's what you're thinking; it's the sensible way of handling it. If you have a specific reason for wanting to do it differently then there probably is a way.
Give a simple example of what you're trying to do, if possible.
Paul
|
|
|
|
|
CustomerList : IBindingList
here I implemented this class and this adds Customer objects
CUstomer : IEditableObject
This is the customer class
inside is
private CVendor objVendor;
public CVendor Vendor
{
get { return objVendor; }
set { objVendor = value; }
}
And what I did was created a class that inherits the DataGrid and assinged a customer tab le style
I want to display Vendor.Name property
but when I tie this property it gives the default toString which is ACS.Vendor (namespace:class)
so I overrided the ToString()
what I would like is a way to map inside my column directly to custom properites within a class
thanks for the help
nick
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
here is what i have and what is happening. I have a main form then another form opens when user clicks the add button. on this form when you add the new information an error check is suppose to run. my problem is i need the error check to stop running and leave the focus on the 2nd form to show where the error is. instead it wants to go back to the main form and finish executing the code that was started when the 2nd form opened! any suggestions thanks
|
|
|
|
|
try using a try/catch block on the code in question
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
that is not quite what i am looking to do. i believe a try catch is for debugging your own code sort of.....i need am trying to throw messages to the user if there input is wrong. thanks for the help though
|
|
|
|
|
well its about validation just because you use a try catch doesnt mean you do or dont have to throw a message. Obciously if there is an error you need to catch it and determine what is wrong and how to resolve the issue
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
try opening the form like this
Form2 fm2 = new Form2();
Form2.ShowDialog();
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
If you could post some code it might help
- monrobot13
|
|
|
|
|
thanks but i already figured it out thanks for the interest thought i am sure i will be posting more questions in the future!
|
|
|
|
|
Has anyone been sucessful in subclassing the desktop on Windows 2k. I have been trying this
private void Form1_Load(object sender, System.EventArgs e)
{
DskPaint = new Subclass(GetDesktopWindow());
}
public class Subclass : System.Windows.Forms.NativeWindow
{
private const int WM_PAINT = 0x000F;
public Subclass(IntPtr handle)
{
//base.AssignHandle(handle);
AssignHandle(handle);
}
protected override void WndProc(ref Message m)
{
MessageBox.Show("Meesage");
switch(m.Msg)
{
case WM_PAINT:
MessageBox.Show("Paint Called");
break;
default:
base.WndProc(ref m);
break;
}
}
}
The WndProc never gets hit?
Any ideas?
Thanks
Forever Developing
|
|
|
|
|
Simple - the desktop is not in your process space, so you can't subclass it.
"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
|
|
|
|
|
Then how does spy++ tool do it?
Is this a dot net rule?
Forever Developing
|
|
|
|
|
This isn't a .NET rule - it's a Windows rule.
What are you trying to accomplish? It's likely there is another way to do it.
"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
|
|
|
|
|
I am trying to draw on the desktop. I need to be notified of the WM_Paint message for the desktop otherwise what I draw is erased on the next WM_Paint.
Thanks for your help
Forever Developing
|
|
|
|
|
And why do you need to draw on the desktop?
"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
|
|
|
|
|
Just for fun.
Forever Developing
|
|
|
|
|
It might not be what you want to do, but check out the ControlPaint class.
|
|
|
|
|
I do not know of a way in .NET but in Win32 you can probably do it with a DLL and HookProc. It will map your DLL into the system memory space were you can trap the messages. I used this method in the old days to communicate with the AOL software and capture its messages.
Rocky Moore <><
|
|
|
|
|
It's best not to deal with system-wide hooks, but it can be done. The main thing is that if your DLL hangs, the system hangs. (I've had experience with that! ) You might also look into a journal hook, although it may not work for paint messages.
"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:
The main thing is that if your DLL hangs, the system hangs.
Makes debugging interesting
Actually, I never had any problems with System Wide Hooks. The code required to implement them is not complex and as long as you keep to only what is required and do not pile a lot into the DLL, things should be fine.
You need to watch when you attach and detach from different applications, a goof in there can cause strange things to happen
Thre are not anything to be afriad of though, I used them for years with the application I mentioned and never recieved on issue about it crashing their system.
Rocky Moore <><
|
|
|
|