|
Wow, thanks!
Funny, you have to comma delimit the new constraint after another constraint...
public class MyCollection<T1, T2> : Component where T1: MyClass1, new() where T2 : MyClass2
...but not the where of the subsequent constraint?
Sure does work. I appreciate the tip.
m
|
|
|
|
|
I have a database application that has a datatable bound to both a DataGridView and some text boxes. The text boxes, collectively, show one row of data. Now, if a user has edited a row and clicks 'Save' in the File menu, I want those changes to be saved. Right now, I'm basing the decision to save or not save a row on whether the DataRowState for that row is 'Modified'. But, if the row the user has edited still has the 'focus', so to speak, the DataRowState is not 'Modified', but 'Unchanged', even if the individual values in the text boxes (to which the data table is bound) have been changed. As soon as I go view another row in the database, though, the DataRowState becomes 'Modified'. Is there an easy way to validate the row without leaving it?
|
|
|
|
|
Just a guess, but you might try calling the EndEdit method on the DataRow prior to checking its DataRowState.
|
|
|
|
|
I thought of that, too, but it did not work. When I googled the problem, I found a solution. Basically, if I call the BindManagerBase.EndCurrentEdit() method, that updates the datatable with any changes that are in progress and changes the DataRowState, as appropriate.
|
|
|
|
|
Has anyone successfully customized the PageSetupDialog - by adding a control or 2 - as outlined in the MSDN help?
MSDN Home > MSDN Library > Win32 and COM Development > User Interface > Windows User Interface > User Input > Common Dialog Box Library >
If so how did you manage it? I can't seem to get it to work and in the MSDN forum I was told it can't be done, which contradicts the MSDN documentation.
(Sometimes I wish we'd stuck to C++)
Thanks in advance.
Happy programming!!
|
|
|
|
|
I'm trying make a simple telnet client to connect to a JTAG tool. I'm displaying the telnet data to a richtextbox. It is coming along but I'm have a problem trying to get the arrows keys to send. Do you know how to treat the arrow keys like any other key and have it call the keypressed event handler?
Thank You for any help or suggestions.
|
|
|
|
|
Hi,
You have to create a new inherited control from RichTextBox and make an override of the "IsInputKey" or "InputKey" method. This method returns a boolean that indicates if the system has to process the key event. Search in MSDN for more info.
|
|
|
|
|
Hi, the term is probably wrong, but this is what I need to do.
I want to make a base class that I cannot create instances of, but holds the prototypes for a bunch of functions. I will subclass from this later and make a real class. is an "interface" what I am looking to use?
For example: I have a method (call it "DoStuff") in a library that takes a "Surface" as one of its arguments. within that method I will evaluate a point on that surface, so "Surface" contains a method GetPoint(u,v). The surface class cannot do any evaluation because it could be a NURBS surface, or maybe an explicit surface, or any other kind that will evaluate differently, so to prevent a runtime bug, I want to prevent anyone from making an instance of "Surface". Instead, I want to create a subclass NurbsSurf : Surface that will know how to evaluate itself at u and v, and I will pass a "NurbsSurf" to "DoStuff", but the "DoStuff" method also needs to accept any other kind of surface that I might create.
Sorry, I know that this is probably a pretty basic question.
Thanks for any help
cb
|
|
|
|
|
You can do this as either an abstract base class
public abstract class Surface{
public abstract void DoStuff() ;
}
or as an interface
public interface Surface {
void DoStuff();
}
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
probably an interface. There are to differences between an interface and an abstract class is that you can have multiple interface inheritance, but only single class inheritance. The second is that you can't implement any methods in an interface definition, but can implement methods in an abstract class if you wish. For inheritance reasons I generally prefer interfaces. IF you've got a number of common stock methods and only a few that need written uniquely for the inheriting classes the abstract route can however be better.
--
CleaKO The sad part about this instance is that none of the users ever said anything [about the problem].
Pete O`Hanlon Doesn't that just tell you everything you need to know about users?
|
|
|
|
|
Thanks for your help.
Sorry for the repeat question.
cb
|
|
|
|
|
dan neely wrote: There are to differences between an interface and an abstract class is that you can have multiple interface inheritance, but only single class inheritance. The second is that you can't implement any methods in an interface definition, but can implement methods in an abstract class if you wish.
The third is that you can publish newer version of abstract class with added concrete method, but you can't extend interface without breaking backward compatibility. IMO important difference for library.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
Abstract class versus Interface[^]
I haven't read the article but it is rated good. In comments, however, is link to Base Class Usage Guidelines[^] (I've read the book) which says that you should favor base class. The reason is, that once you ship interface, you can't extend it without breaking all stuff that implement previous version of interface. You can, however, extend (abstract) base class, without breaking it, as long as added method isn't abstract. (So derived classes dont have problem)
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
thanks again.
Abstract is the way I want to go.
|
|
|
|
|
Hello everyone!
Okay, I have a variable that gets changed to 0 somewhere in my code, and I want to know where.
So I added a variable watch (VS 2005), however, on the watches list, it displays as this with an error icon to the left:
((Server.Client)((new System.Collections.ArrayList.ArrayListDebugView(this.clients)).Items[0])).id <br />
The type name 'Client' does not exist in the type 'Server.Server'
First, I didn't know you could have a type inside another type.
The variable I'm trying to add is public member id of the class Client . Server.Server is a class containing a custom ArrayList of Client s.
Does anyone know why I'm getting that error? Thanks!
Windows Calculator told me I will die at 28.
|
|
|
|
|
Try typing the fully qualified name of Client in the watch window.
|
|
|
|
|
Hi all,
how can I define a struct with a string array (fixed dimension) inside like this:
public struct _ref<br />
{ <br />
public int iId;<br />
public string sDesc;<br />
public string[2] sFields;<br />
}
Thanks in advance,
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
public string[] sFields = new string[2];
|
|
|
|
|
Hello everyone,
I have a Button which I have assign a ConextMenu. The ContextMenu with it's options pops up once the user clicks the right mouse on the button. Is it possible to change this so when the user clicks the LEFT mouse the ContextMenu?
Thank you very much for your help and have a great day.
Khoramdin
|
|
|
|
|
Hello,
private void button1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if(e.Button == MouseButtons.Left)
{
if(button1.ContextMenu!=null)
{
button1.ContextMenu.Show(button1, new System.Drawing.Point(e.X, e.Y));
}
}
}
All the best,
Martin
|
|
|
|
|
Hi everyone,
How to Get Hardware Information in C sharp ?
Example : HardDisk Drive Serial Number, Volume, Product...
Modem Serial Number, Product....
Thanks !!
|
|
|
|
|
|
|
i have a string s i have convert it to ascii code useing this
Byte[] b = Encoding.ASCII.GetBytes(s);
but the ascii code for english character. and i want it for Arabic character, what is the name of the code and is it available in C#.Net 2005
|
|
|
|
|
Unicode supports virtually all existing characters, so you could use for example UTF-8 encoding. Otherwise you can look in the documentation for the Encoding class for all the supported encodings.
---
single minded; short sighted; long gone;
|
|
|
|