|
Implement the following and it will show the exception that is occurring:
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
// Connect to the unhandled exception event
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new TestApp());
// Disconnect from the unhandled exception event
AppDomain.CurrentDomain.UnhandledException -= new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
}
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
// Show the exception to the user. This could be written
// to a file, but since this is just a test app...
MessageBox.Show(e.ExceptionObject.ToString());
if (!e.IsTerminating)
Application.Exit();
}
Phil
|
|
|
|
|
Hi,
I'm currently working with user controls under VS2005.
VS2005 does provide a handy tool called "UserControl TestContainer" for every user controls in my project.
However, I need to configure one of my user controls in the project to be the first one to display.
The problem here is that I'm using a third party control and it doesn't render correctly if its parent form is not the first one to be rendered. So I need a way to set the form as a startup user control.
Is there any way to do that?
Thank you very much.
KiT
Never wait for a chance to come, Believe in your own potential and go get it!
|
|
|
|
|
None that I know of, I'm afraid.
|
|
|
|
|
Good day,
I have a user control. My user control is customize Panel which can be minimize or maximize. I use Transparent as background of my control.
I tried to test my new control under a form that has a background picture. When I run my test program, i've tried to minimize my user control Panel but the area that was left behind by my panel is NOT the background image picture of the form where i put my user control instead the trasparent color appear.
Is there a way that we could get the background of the Area what was overlapped by my user control ? How can I make my user control aware of the background area that it overlapped at design time so that I could restore that area when my control is minimize?
Any suggestions would be appreciated.
Thanks,
|
|
|
|
|
The simplest thing to do is to invalidate or refresh the form when the customize Panel is minimized/maximized. You can let the customize Panel trigger a minimized/maximized event back to the parent control or just use the 'this.Parent.Refresh()' but that's not a very neet way of handling the problem.
Another way of solving the problem is to calculate the area that should be invalidated and then repaint only that small area.
I hope that might give you some idé to solve the problem.
|
|
|
|
|
Hi SNews
Thanks for your feedback, however, I already tried to add a handler to my panel. so that in the forms code :
mypanel.SetParentControl(myparentcontrolorparentform);
and on my panel code:
private Control m_parentcontrol=null;
public void SetParentControl(Control e) { m_parentcontrol=e; }
[Browsable(true)]
[TypeConverter(typeof(boolValueConverter))]
[DisplayName("Collapse"), Category("Panel Information"), Description("Minimize/Maximize Panel")]
public bool Collapse
{
get { return m_isminimized; }
set {
m_isminimized = value;
if(m_parent!=null) m_parentcontrol.Refresh();
Refresh();
}
}
However the when my panel is minimized, the area that was left behind displays the transparent color. If its okay with you, can i ask for your email address so that I could email you the output sample of my program.
Perhaps I'll to follow your second suggestion, however how can my user control aware or get the area only that it has overlapped?
Thanks
|
|
|
|
|
Yes, send me an email through the message board and I will reply to that so you get my email adress.
|
|
|
|
|
please.. i need a sample... or please check if somethings wrong in this program..its not saving..and i think the connection string is not valid but it doesnt build any errors until you save in the database.
OleDbConnection connect=new OleDbConnection();
connect.ConnectionString="PROVIDER=DB2OLEDB; initial catalog=SAMPLE;integrated security=SSPI";
connect.Open();
OleDbCommand cmd_save =new OleDbCommand("INSERT INTO test(name,year,course)"+"VALUES("+"'"+textBox1.Text+"'"+","+"'"+textBox2.Text+"'"+","+"'"+textBox3.Text+"'"+")",connect);
cmd_save.ExecuteNonQuery();
connect.Close();
thanks for the help..
|
|
|
|
|
Check this to get some help with the connection string.
http://www.carlprothman.net/Default.aspx?tabid=86#OLEDBManagedProvider
But it sure seems odd that the error isn't raised when the Open() method is called. Must be the INSERT statement that's wrong. I don't know for sure if it's ok to write the ending ) of the data declaration without any space before VALUES( ... ) declaration.
I can also recommend you to start using SqlParameter to get a safer and smoother SQL handling.
Take a look here for a quick example:
http://www.samspublishing.com/articles/article.asp?p=27640&seqNum=6&rl=1
Hope it helps some
|
|
|
|
|
thanks.. its now running. But the problem is that i cant save data on the database. The exception is that the provider=DB2OLEDB is not available in the local machine.
it highlights the statement where i insert values. thanks.
|
|
|
|
|
and also the site that you give is not valid..
thanks..
|
|
|
|
|
I try to use
this.Text = "\u149d";
But I get strange character.
Thank You.
|
|
|
|
|
I am using the following code to draw an image. I want it to add to my page, the current code erases my page and only shows the image.
Bitmap draw = new Bitmap(500, 20);<br />
Graphics g = Graphics.FromImage(draw);<br />
<br />
g.DrawImageUnscaled(topleft, 0, 0);<br />
<br />
for (int i = 13; i <= intTableWidth; i++)<br />
{<br />
g.DrawImageUnscaled(contop, i, 3);<br />
}<br />
<br />
draw.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
The only way to speed up a Macintosh computer is at 9.8 m/sec/sec.
|
|
|
|
|
Add a panel at design time and @ the position where you want to display the graphic.
and add creating this graphic, add this to the panel
Nana
|
|
|
|
|
How do I draw on a panel?
The only way to speed up a Macintosh computer is at 9.8 m/sec/sec.
|
|
|
|
|
Dont draw on panel.
Whenever ur object g is ready,
just say pnlGraph.Add(g);
Nana
|
|
|
|
|
I am using WebControls, it does not have a method Add. How do I do it on a web panel?
The only way to speed up a Macintosh computer is at 9.8 m/sec/sec.
|
|
|
|
|
pnlGraphic.Controls.Add(g);
Nana
|
|
|
|
|
Graphics is not a control.
The only way to speed up a Macintosh computer is at 9.8 m/sec/sec.
|
|
|
|
|
send me entire code.
whats contop?
Nana
|
|
|
|
|
public void DrawBorder()<br />
{<br />
Bitmap draw = new Bitmap(intTableWidth, intTableHeight);<br />
Graphics g = Graphics.FromImage(draw);<br />
<br />
g.DrawImageUnscaled(topleft, 0, 0);<br />
g.DrawImageUnscaled(topright, intTableWidth - 12, 0);<br />
g.DrawImageUnscaled(bottomleft, 0, intTableHeight - 12);<br />
g.DrawImageUnscaled(bottomright, intTableWidth - 12, intTableHeight - 12);<br />
<br />
for (int i = 12; i <= intTableWidth - 12; i++)<br />
{<br />
g.DrawImageUnscaled(contop, i, 0);<br />
g.DrawImageUnscaled(conbottom, i, intTableHeight - 12);<br />
}<br />
<br />
for (int i = 11; i <= intTableHeight - 12; i++)<br />
{<br />
g.DrawImageUnscaled(conleft, 0, i);<br />
g.DrawImageUnscaled(conright, intTableWidth - 12, i);<br />
}<br />
<br />
draw.MakeTransparent(Color.Transparent);<br />
draw.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);<br />
<br />
g.Dispose();<br />
draw.Dispose();<br />
}
And
<br />
<br />
private Bitmap topleft;<br />
private Bitmap topright;<br />
private Bitmap bottomleft;<br />
private Bitmap bottomright;<br />
private Bitmap contop;<br />
private Bitmap conbottom;<br />
private Bitmap conleft;<br />
private Bitmap conright;<br />
<br />
The only way to speed up a Macintosh computer is at 9.8 m/sec/sec.
|
|
|
|
|
I am working on an application that is a card based computer game. In the application there are playing cards made out of controls, and each of the control is an element of a control array. Each of the cards must be able to be a child to another card and/or a parent control to another card.
This creates a situation in which any control could be dragged onto another control based upon compliance with the rules of the game. However, the problem occurs when there is the capability to drag a parent control onto an already placed child control.
Here is the problem. When a child is dragged onto its parent control it generates the error: "A circular control reference has been made. A control cannot be owned or parented to itself."
How do I resolve this circular control reference or completely prevent the possibility of a child control from being dragged onto its parent in the first place?
The code for the DragOver event for each of the controls is as follows:
private static void _ctrlParent_DragOver(object sender, DragEventArgs e)
{
try
{
if ( DragDropHandler.CanDropHere((Control)sender, e.Data) )
{
Control cthis = (Control)sender;
e.Effect = DragDropEffects.Move;
Control ctrl = DragDropHandler.GetControl(e.Data, true, true);
if (!(ctrl is IDragDropEnabled))
{
return;
}
if (cthis.Name != ctrl.Name)
{
ctrl.Parent.Controls.Remove(ctrl);
ctrl.Parent = cthis;
cthis.Controls.Add(ctrl);
ctrl.BringToFront();
Point NewLocation = cthis.PointToClient(new Point(e.X, e.Y));
ctrl.Left = NewLocation.X - dragPoint.X;
ctrl.Top = NewLocation.Y - dragPoint.Y;
}
else
{
return;
}
}
else
{
e.Effect = DragDropEffects.None;
}
}
catch (Exception ex)
{
MessageBox.Show("Error is " + ex.Message);
}
}
NOTE: When the child control is dragged onto the parent control, both controls disappear from the screen because of the circular reference error generated. How is a test performed to prevent a circular reference when it is necessary to have the potential to be both a child and a parent control?
-- modified at 20:50 Sunday 25th February, 2007
|
|
|
|
|
Hi,
Does anyone know where I can find out how to change the colours of the column header row in a listview?
I can't find anything on the net at all.
Cheers,
Glen Harvy
|
|
|
|
|
I want to use an Xml file as my config file, i know how to read the data from the file, but wondering if there is a way to update just one field of the xml with out creating a new xml file. If someone can point me to an example or the xml command to use.
Thanks
Rob
|
|
|
|
|
Use the XmlDocument class, and an XPath with SelectSingleNode to find the node you want to update.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|