|
Hi there, I someone can help me... this is driving me nuts...
I have a form (with textboxes and buttons) with dynamically created user controls (BasePanel) when the user presses the Add button. On that user control is a textbox.
When that user control gets created, one of two possible user controls (GeneralEntry - initially - or EventEntry) are added to that user control, which contains a series of maskedtextboxes. If the user types a letter in this first maskedtextbox, then the GeneralEntry gets replaced with the EventEntry user control, which has a different series of maskedtextboxes.
Now, what I want to have happen is that on the last textbox on the form, when the user presses Tab, it goes to the first maskedtextbox on the GeneralEntry, but it doesn't... it goes to the textbox on the BasePanel.
I have tried assigning all the tab orders so that the all in the correct order, but there seems to be a precedence of controls... form, then user control, then next user control, etc...
I have also tried suppressing the Tab key and forcing the SelectNextControl... but that's not working either, as the Tab key doesn't seem to be able to be suppressed or handled.
Does anyone have any suggestions please?
Thanks in advance!
Paul
One day I want to be a code monkey. Right now, I'm more like a code amoeba...
|
|
|
|
|
Some keys are treated in different way than others. Probably tab key is one of them. I think you will need to handle that in ProcessCmdKey method .
"If you had to identify, in one word, the reason why the human race has not achieved, and never will achieve, its full potential, that word would be 'meetings'." - Dave Barry
|
|
|
|
|
Thanks for that Dave.
A bit of a learning curve to use that method, but it seems like it will meet my needs.
Cheers
Paul
One day I want to be a code monkey. Right now, I'm more like a code amoeba...
|
|
|
|
|
Poolee wrote: Thanks for that Dave.
Who's Dave?
"If you had to identify, in one word, the reason why the human race has not achieved, and never will achieve, its full potential, that word would be 'meetings'." - Dave Barry
|
|
|
|
|
LOL, got the name from the siggie... *slaps self repeated ly*
One day I want to be a code monkey. Right now, I'm more like a code amoeba...
|
|
|
|
|
What is the best way to parse an xml file?
the XML reader class or the Regex class?
I need to connect to an access database that could be located anywhere on the local system but will have a DSN set up in the ODBC connectors. I know how to read the reg and find out if the DNS is setup
can i write directly to the DSN or do I have to read the DSN settings and set my DB connection in the program?
|
|
|
|
|
I've found that the DSN connection is not the best way to connect to the database and found how to connect to it, I will look at if I can build the OLE connector from reading the Registry
|
|
|
|
|
XmlDocument
Why use ODBC? Better to use the OleDb connecter.
I cobble up connection strings from values in XML.
|
|
|
|
|
All of the code that has been written before I started at this job has been written in VBscript. very impressive in everything that has been via VBscript. We have a bunch of people who run these scripts that allow you to put the database anywhere. the VBscripts all use the ODBC connector to write to the DB, so I'm looking for the solution that will allow the flexibility of still putting the database anywhere on the computer.
Is the ODBC connection settings stored in an xml file? I'm going to look at building the OleDb connectionString if I can find something static to build it from.
thanks for the recommendation of Xmldocument
|
|
|
|
|
Do someno knows a good truthful tutorial about using graphics on form
I've already read everything
1- Do not use a PictureBox to draw but a pannel
2- Do not use a pannel to draw but a picturebox
3- Use a pannel with doublebuffer
4- Do not use Doublebuffer but bufferedgraphics
and so and so ...
So for now I'm using PictureBox because I do not know how to draw on panel
I'm using graphics because I do not know how to use BufferedGraphics
And I don't know how to use doublebuffer
But I want to improve my knowledge but I don't know where is the truth ?
|
|
|
|
|
I doesn't matter too much where you draw, so long as you do it right. Basically, you either want to override the OnPaint method for a control (requires you to make a custom control, which is really easy), or simply use the OnPaint event. In either case you will get a Graphics object in the PaintEventArgs which is what you should use.
Now double buffering, try whatever it is you want without it (ie. Just draw your stuff using the aforementioned Graphics object). Then if you find that your form flickers, you may want to use double buffering. If you can it would be easier to use the DoubleBuffered property, if you can't then you can make up your own. Setting up your own double buffering is easy, simply create a bitmap with the same dimensions as your form/control and do all of your drawing to that, then you just draw the image to the screen in one go, like this:
Bitmap myBuffer = new Bitmap(200,200);
void OnPaint(object sender, PaintEventArgs e)
{
Graphics buffer = Graphics.FromImage(myBuffer);
buffer.Dispose();
e.Graphics.DrawImageUnscaled(myBuffer, 0, 0);
}
And if you want to go all out then check my articles here[^] (which one day I WILL get round to finishing dammit!)
My current favourite word is: Nipple!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
Bitmap myBuffer = new Bitmap(200,200);
void OnPaint(object sender, PaintEventArgs e)
{
Graphics buffer = Graphics.FromImage(myBuffer);
buffer.Dispose();
e.Graphics.DrawImageUnscaled(myBuffer, 0, 0);
}
Hello SK Genius
I'm not sure about this example
1- You create a Grappfics 'buffer' FromImage(myBuffer);
2- Immediately after you dispose that 'buffer'
So what is the purpose of 'buffer' in that example ??
|
|
|
|
|
You do all your drawing onto the new buffer object, and then once you've finished you dispose of it.
My current favourite word is: Nipple!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
IMO it doesn't really matter where you draw on.
If you need to redraw often use double buffering to avoid flickering.
The main thing you should ask yourself, when and how do I redraw?
eg. A while ago, when learning GDI+ on my own, I made the snake game. I used a panel and doublebuffering and it works perfectly. If I disable double buffering, the thing flickers a lot.
When did I redraw: When the snake moved
How did I redraw: I simply removed the last section of the snake and added one section in front instead of redrawing the entire thing.
|
|
|
|
|
Thank you V.
For my purpose I need to display a little portion of a big image and allow to move around the big image with zoom
So
1- I build the big image in memory
2- I take a clip of the big image on a smaller image (using DrawImage with a source rectangle on the big image and a destination rectangle on the small image
3- Then I assign the small image to the PB.Image
So everytime the user wants to move the image I process 2 and 3
My feeling now is that I can be more performant using a pannel instead a PB
And process 2 directly on the pannel surface without having to do 3
Am I right ?
|
|
|
|
|
If you want excellent performance for this, then you may want to use the old GDI which will be much faster, although it does involve P/Invoke and a fair bit more messing around it would definately solve any performance issues.
My current favourite word is: Nipple!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
Thanks a lot SK Genius
I will consider this !
|
|
|
|
|
I'm trying to work with a user control that is added to the Winform at run time. The problem I'm dealing with is that the underlying properties and methods in the user control aren't inaccessible when using my approach. If I draw the user control directly on the Winform, the properties and methods are easily accessible.
The code I'm using to add the control is:
namespace WindowControlTest
{
public partial class WindowMain : Form
{
public WindowMain()
{
InitializeComponent();
int iPlayers = 4;
UserControl uctlPlayerPane = new UserControl();
switch (iPlayers)
{
case 2:
uctlPlayerPane = new uctl_2Player();
break;
case 3:
uctlPlayerPane = new uctl_3Player();
break;
case 4:
uctlPlayerPane = new uctl_2Team();
break;
case 6:
uctlPlayerPane = new uctl_2Player();
break;
}
uctlPlayerPane.Location = new Point(25, 25);
this.Controls.Add(uctlPlayerPane);
}
}
}
When I go through the debugger, the property does appear under uctlPlayerPane under the [WindowControlTest.uctl_2Team] entry, but I can't seem to figure out how to get at it. Am I using the wrong approach for this, or am I missing something else.
Thanks all.
|
|
|
|
|
You'll need to cast uctlPlayerPane to the correct type to access that type's properties and methods. To know which type it is, you can either do
if (uctlPlayerPane is uctl_2Player)
{
...
}
else if (...
or create an enum of the available types, use a private variable to indicate which type is selected and use an if or switch on that.
Both of the above will get cumbersome though so it may not be the best solution, but it will work!.
You could have an interface that specifies all the methods and properties that all the controls will have, and throw NotImplementedExceptions in the controls where the property or method would not normally be available and catch them as neccesary. I don't like deliberately throwing exceptions, but again, if suitable for your purposes, it will work.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Hello,
I currently have a reportviewer on my form and I wish to export the data to an Excel and/or PDF file. I know this can easily be accomplished using the built in toolbar of the reportviewer but I want to be able to use my own buttons. I don't see the need to render my own report as I want to do exactly as the toolbar drop down for exporting to Excel and PDF does already. I just want to instigate this process using my own button. Does anyone know if this is possible?
Thanks for your time!
Christian
|
|
|
|
|
I know that the Crystal Reports objects directly support outputting through code and samples are available online.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
Thanks for the response! My reports are already designed so I think I'm stuck with the built in reports and reportviewer.
I want to do exactly what the built in toolbar does but from my own button.
Thanks!
|
|
|
|
|
I want two fields as ID fields(Value Member) along with a Display Member for DataGridViewComboboxColumn. How can I implement it?
|
|
|
|
|
what do you have to show? why can´t you do that? do you are able to connect to database?
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
I have created the following:
public interface ICalculatable
{
DateTime FirstPaymentDate { get; }
decimal MonthlyCompoundingRate { get; }
}
public interface IBaseObject : ICalculatable
{
string Identifier { get; }
DateTime FirstPaymentDate { get; set; }
decimal InterestRate { get; set; }
}
public class BaseObject : IBaseObject
{
...
}
I get a compiler error that need new to hide inherited member. I am trying to figure out if that is the correct thing or I need to use virtual/override/etc.. instead.
I will be accessing the BaseObject as ICalculatable in other code and the FirstPaymentDate properties should be the same value/source.
Thanks in advance.
WarePhreak
Programmers are tools to convert caffiene to code.
|
|
|
|