|
Put the common bits on a UserControl, derive from that, and stick it on a TabPage.
(In my opinion we should be able to design directly on a TabPage as easily as on a UserControl, but alas we can't. )
|
|
|
|
|
You can derive directly from TabPage, though you can't use the visual designer if you do that. I've done this in the past for a similar type of situation (a tab control of which every tab was a data sheet).
|
|
|
|
|
Yes, and I've done that too, but I want to design on it. I have tried using #if #else #endif , but most recently I gave up and did:
public partial class tpDataTable : System.Windows.Forms.TabPage
// public partial class tpDataTable : System.Windows.Forms.UserControl
to manually switch between base classes.
|
|
|
|
|
Haha, yeah, I've done that same thing in the past.
|
|
|
|
|
You could create your base class as a custom control from a UserControl, adding any common properties, methods, controls etc, and then create other custom controls that inherit from the base. Then you could just add a tab control to your form with your custom controls as controls inside each page.
Hope this helps
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
Thanks Guys,
I have created a UserControl and added it to each page no probs, I think it will do what I want now.
Thanks again.
|
|
|
|
|
A bit OT: this thread reminds me of a hack I once did where I had, for each TabPage in a WinForms TabControl, a set of Controls that had identical functionality in each TabPage (even if the controls did 'harvest' information unique to the TabPage they were inside).
In order to avoid duplicating them on each TabPage, I just put the controls in a UserControl, and inserted them ... as the user changed TabPages ... using the SelectedIndexChanged Event ... into the the currently visible TabPage.
Of course I did the right thing so that the Controls inside the UserControl were exposed, and could be accessed, and could have top-level event-handlers, etc.
Never quite decided if this was a clever hack, or just poor design
best, Bill
"Last year I went fishing with Salvador Dali. He was using a dotted
line. He caught every other fish." Steven Wright
|
|
|
|
|
When I tell a socket to "listen," what IP Address should I tell it to use?
When I use "netstat /a", it shows me the following possible local IP Addresses:
0.0.0.0
127.0.0.1
192.168.0.2 // This is the machine's address on my LAN
Which one should I use in the call to Bind ? (It accepts all of them)
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I think I figured it out. I should use IPAddress.Any .
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Always the best choice, unless you have multiple interfaces and you need to bind to an interface that has access to a particular network segment.
|
|
|
|
|
Richard Andrew x64 wrote: 127.0.0.1
I always thought that 127.0.0.1 would be localhost.
|
|
|
|
|
It is.
There's nothing preventing you from running the client and server on the same machine.
If the machine isn't connected to a network, the app still works.
|
|
|
|
|
Any address of the form 127.*.*.* is a loop back address.
|
|
|
|
|
This is the address I would use in your binding instance.
|
|
|
|
|
Richard Andrew x64 wrote: 0.0.0.0
That should basically say - use all network IPs to bind to. Which is only relevant if your computer has two network addresses. Which is more common if you have two network cards but might also be possible in other situations.
Richard Andrew x64 wrote: 127.0.0.1
Any address of the form 127.*.*.* is a loopback address. It will not exit the local machine.
Richard Andrew x64 wrote: 192.168.0.2
This is the address that that allows your computer to be addressed on a network. This is comparable to 0.0.0.0 except that it is specific to one network segment (only relevant if you have more than one.)
It is also a private network address. That in combination with firewalls/routers might or might not mean that using that address (or 0.0.0.0) would mean that your server is available from other locations on the private network. That address would never be visible outside (like the internet) the private network.
Typically for network exposure one should probably use a specific address and not use 0.0.0.0 because if there is more than one network segment then it is unlikely that exposing the server on both is the intent of the additional segments.
Allowing it the network address to be explicitly specified, via a configuration value, is probably a good idea.
|
|
|
|
|
Thanks for this informative post.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
127.0.0.1 ,this may be true,you can try
|
|
|
|
|
I am new in WCF, I created DataContract, defined Datamembers and using DataContractSerializer for serialization . but getting error
'EndElement' 'ReadRequest' from namespace "is not expected. Expecting element 'Header'.
Please help me to identify the issue.
Thanks in advance !!!
|
|
|
|
|
Sachin Sangal wrote: I am new in WCF
Then I suggest you move your question to the WCF forum.
|
|
|
|
|
Thanks Richard...
I have posted on WCF forum as well...
|
|
|
|
|
Which is called cross posting and is frowned upon!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I always make mistakes in making our company's code project .who can help me ?
Zincsulfates[] from Rech Chemmical
|
|
|
|
|
Why are you trying to hyjack someone elses thread??
Post this as a new thread and rewrite the "question" you asked. I say that because you didn't ask a question at all nor did you detail what kind of problem you're having, other than you always screw up code.
|
|
|
|
|
Hi guys, I've just encountered a strange bug (I think?) in ArrayList.Clone()
Here's my code :
public ShipChromosome(ArrayList deckLength, ArrayList shipList, ArrayList allShipList)
{
deckList = deckLength;
shipsInDeck = (ArrayList)shipList.Clone();
allShips = (ArrayList)allShipList.Clone();
}
#region IChromosome Members
public IChromosome Clone()
{
return new ShipChromosome(deckList, shipsInDeck, allShips);
}
Okay, Here's the exception :
System.ArgumentException was unhandled - Destination array was not long enough. Check destIndex and length, and the array's lower bounds.
Some detail about parameters:
deckList = ArrayList containing many int (s)
shipsInDeck = ArrayList containing (deckList.Count ) ArrayList (s) which hold many ShipObject
allShips = ArrayList containing all ShipObject (s) in ShipsInDeck (Hey, I'm lazy!! )
Any idea guys?
Oxfords English < Official CCC Players Dictionary
Excuse me for my improper grammar and typos.
It's because English is my primary language, not my first language.
My first languages are C# and Java.
VB, ASP, JS, PHP and SQL are my second language.
Indonesian came as my third language.
My fourth language? I'm still creating it, I'll let you know when it's done!
|
|
|
|
|
We need more information and context.
What are the counts/lengths of those collections?
Does it go wrong the very first time, or just after a lot of similar operations?
Are some of those collections growing all the time?
What is this app about?
|
|
|
|