Click here to Skip to main content
15,896,154 members
Home / Discussions / C#
   

C#

 
QuestionHelp. I'm Lost. How to retrieve the selected row information from a DataGridView Pin
TheFoZ22-Jun-08 8:04
TheFoZ22-Jun-08 8:04 
AnswerRe: Help. I'm Lost. How to retrieve the selected row information from a DataGridView Pin
User 665822-Jun-08 8:22
User 665822-Jun-08 8:22 
GeneralRe: Help. I'm Lost. How to retrieve the selected row information from a DataGridView Pin
TheFoZ22-Jun-08 8:25
TheFoZ22-Jun-08 8:25 
GeneralRe: Help. I'm Lost. How to retrieve the selected row information from a DataGridView Pin
Harvey Saayman22-Jun-08 8:56
Harvey Saayman22-Jun-08 8:56 
GeneralRe: Help. I'm Lost. How to retrieve the selected row information from a DataGridView Pin
TheFoZ22-Jun-08 9:16
TheFoZ22-Jun-08 9:16 
GeneralRe: Help. I'm Lost. How to retrieve the selected row information from a DataGridView Pin
Paul Conrad22-Jun-08 9:36
professionalPaul Conrad22-Jun-08 9:36 
QuestionHow to call base class methods automatically? Pin
Metal7622-Jun-08 7:34
Metal7622-Jun-08 7:34 
AnswerRe: How to call base class methods automatically? Pin
Scott Dorman22-Jun-08 7:50
professionalScott Dorman22-Jun-08 7:50 
Yes, it can be error-prone, but there isn't a way to automatically call the base class methods. You could implement a virtual method on Command that handles this for you and then in the derived classes override that method instead. It would make your classes look like this:
C#
public abstract class Command : Message
{
   protected byte[] CompileCommandPacketPart()
   {
   }
 
   public virtual byte[] CompilePacket()
   {
         // Compiles the generic parts of the command
         CompileCommonPacketPart();
         CompileCommandPacketPart();
   }
}
 
public class MyCommand : Command
{
   public override byte[] CompilePacket()
   {
      base.CompilePacket();
      // Adds parts specific to this command
   }
}
This simplifies things a bit in that you only have to call base.CompilePacket(). Thinking about it a bit more, you might be able to do this:
C#
public abstract class Command : Message
{
   protected byte[] CompileCommandPacketPartInternal()
   {
   }
 
   protected abstract byte[] CompileCommandPacketPart()
   {
   }
 
   protected byte[] CompilePacket()
   {
         // Compiles the generic parts of the command
         CompileCommonPacketPart();
         CompileCommandPacketPartInternal();
         CompileCommandPacketPart();
   }
}
 
public class MyCommand : Command
{
   public override byte[] CompileCommandPacketPart()
   {
      // Adds parts specific to this command
   }
This will work as long as the order of calls in Command.CompilePacket() will always be the same. In either case, you might want to make some of the protected methods internal or private instead.

Scott Dorman
Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA

[Blog][Articles][Forum Guidelines]
Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai

AnswerRe: How to call base class methods automatically? [modified] Pin
User 665822-Jun-08 8:09
User 665822-Jun-08 8:09 
AnswerRe: How to call base class methods automatically? Pin
S. Senthil Kumar22-Jun-08 10:17
S. Senthil Kumar22-Jun-08 10:17 
AnswerRe: How to call base class methods automatically? Pin
Joe Woodbury22-Jun-08 13:27
professionalJoe Woodbury22-Jun-08 13:27 
GeneralRe: How to call base class methods automatically? Pin
Metal7623-Jun-08 4:05
Metal7623-Jun-08 4:05 
QuestionGet Class Info Pin
half-life22-Jun-08 5:45
half-life22-Jun-08 5:45 
AnswerRe: Get Class Info Pin
zafersavas22-Jun-08 5:57
zafersavas22-Jun-08 5:57 
GeneralRe: Get Class Info Pin
0x3c022-Jun-08 6:15
0x3c022-Jun-08 6:15 
GeneralRe: Get Class Info Pin
half-life23-Jun-08 8:26
half-life23-Jun-08 8:26 
QuestionConverting Firefox's icon string to the image !!! Pin
Mohammad Dayyan22-Jun-08 3:58
Mohammad Dayyan22-Jun-08 3:58 
AnswerRe: Converting Firefox's icon string to the image !!! Pin
User 665822-Jun-08 4:03
User 665822-Jun-08 4:03 
GeneralRe: Converting Firefox's icon string to the image !!! Pin
Mohammad Dayyan22-Jun-08 4:14
Mohammad Dayyan22-Jun-08 4:14 
QuestionHow to stop running thread ? Pin
Yanshof22-Jun-08 3:29
Yanshof22-Jun-08 3:29 
AnswerRe: How to stop running thread ? Pin
Guffa22-Jun-08 3:33
Guffa22-Jun-08 3:33 
AnswerRe: How to stop running thread ? Pin
half-life22-Jun-08 5:03
half-life22-Jun-08 5:03 
GeneralRe: How to stop running thread ? Pin
N a v a n e e t h22-Jun-08 5:39
N a v a n e e t h22-Jun-08 5:39 
AnswerRe: How to stop running thread ? Pin
N a v a n e e t h22-Jun-08 5:37
N a v a n e e t h22-Jun-08 5:37 
AnswerRe: How to stop running thread ? Pin
Joe Woodbury22-Jun-08 12:15
professionalJoe Woodbury22-Jun-08 12:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.