|
Thanks for the help.
Since this is my first Custom Control i guess I'm not sure how to debug it. I added my HL7TreeView Control Library Project to a test project. Then I added a generic TreeView control to the Windows form. I changed the declaration to use HL7TreeView instead of plain TreeView, but the debgger won't enter my Control Library code. Any hints you can give on debugging a custom control ?
|
|
|
|
|
Hi,
I'm having trouble setting the main form visible from within the child form. I have set the main form to hide (SignatureMain.Hide()).
I then load the child form from within a button on form1:
Treatment.ShowDialog();
On the child form Treatment i try to do the following in an Exit button:
this.ParentForm.Visible = true;
this.Close();
What i'm gettign is the following:
An unhandled exception of type 'System.NullReferenceException' occurred in Signature.exe
Additional information: Object reference not set to an instance of an object.
NOTE:
I have even set the parent form as follows:
Treatment.ShowDialog(this);
This is suppose to set the this (SignatureMain) as the parent to Treatment.
When i run the debbugger and look at ParentForm, its null???
Thanks
|
|
|
|
|
Ok i have figured out the solution. Here it is for anyone looking for the information later.
When loading a form using: myForm.ShowDialog(this) were "this" is the OWNER of the form you are loading, you need to use in the child form the following to get to its properties:
this.Owner.Visible = true; <-- "this" is the child form and i'm accessing the visible property of the parent form (owner).
I'm still not clear as to why Parent and or ParentForm did nto work so if anyone has the answer to that one please post.
Enjoy!
|
|
|
|
|
The Owner or Parent is not immediately available during the creation of the child window/control.
I'm not sure when the reference is exaclty created, but I use the Layout event of the child window with a flag that's set to true when the layout event has been called so the code (or some part of it) in the event handler won't be called again.
<br />
private void Child_Layout....{<br />
if(!flag)<br />
{<br />
flag = true;<br />
}<br />
}<br />
|
|
|
|
|
If I want to draw on a control, is it best to override the OnPaint function or to capture the Paint event?
|
|
|
|
|
When you're inheriting (which you obviously are, since otherwise you wouldn't have the choice) you should override OnPaint . The Paint event exists to notify anyone outside your class that needs to know when you're repainting.
This is true for all the OnXxx protected methods of the class.
Charlie
if(!curlies){ return; }
|
|
|
|
|
To explain why Charlie said what he did (which is correct), overriding is polymorphic, allowing base classes to call your code even though they don't even know about your class. In intermediate language (IL, the code all .NET languages compile to and embedded in assemblies), this instruction uses callvirt instead of simply call . This is much faster to execute and is a good polymorphic design. When you handle events, several - sometimes many - intructions are required to enumerate the delegates for the event (commonly stored in a list after compiling) and to invoke the delegate (late-binding).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hii
i m trying to delete a row using DeleteCommand of DataAdapter, but i can't.
i m using this code..
using System;
using System.Data;
using System.Data.SqlClient;
class ModifyDataTable
{
static void Main()
{
string constr = @"server=(local)\NetSDK;Integrated Security=true;"+
"database=address";
SqlConnection Conn = new SqlConnection(constr);
try
{
string SQL = "SELECT * from Hello";
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = new SqlCommand(SQL,Conn);
DataSet ds = new DataSet();
da.Fill(ds,"Hello");
DataTable dt = ds.Tables ["Hello"];
("Select * From Hello",Conn);
foreach( DataRow r in dt.Rows)
{
Console.WriteLine("{0} {1}",r["Name"].ToString ().PadRight (15),
r["Phone"].ToString ().PadLeft(25));
}
Console.WriteLine("\n" + dt.Rows .Count.ToString ());
da.DeleteCommand = new SqlCommand ("DELETE FROM Hello WHERE (Name='Amit')" ,Conn);
da.Update (ds,"Hello");
Console.WriteLine ("\n" + dt.Rows.Count.ToString ());
foreach( DataRow r in dt.Rows)
{
Console.WriteLine("{0} {1}",r["Name"].ToString ().PadRight (15),
r["Phone"].ToString ().PadLeft(25));
}
}
catch (Exception e)
{
Console.WriteLine ("Error Occured : " +e.Message );
Conn.Close ();
}
finally
{
Conn.Close();
Console.ReadLine ();
}
}
}
This isn't deleting anything neither in the dataset nor in the database
|
|
|
|
|
You should use a DataAdapter when you want your updates and deletes to be managed for you depending on the state of the DataSet .
In your case, you are not altering the <cpde>DataSet, so your delete command is never used.
If you just want to execute a specific delete command:
string sql = "DELETE FROM Hello WHERE (Name='Amit');
SqlCommand comm = new SqlCommand(sql, conn);
conn.Open();
comm.ExecuteNonQuery();
conn.Close();
Charlie
if(!curlies){ return; }
|
|
|
|
|
Im trying to work out how i would go about altering the C# DirectX example "SampleGrabberNET" so i could perform captures from a video file (avi,mpeg,etc) rather than a capture device.
Extremely confused, i can see how the video player example works but not how i intergrate the 2 examples.
Cheers.
|
|
|
|
|
I tried to modify a couple of the icons supplied with .Net using the icon editor I've been using for years. The strange thing is that after I've opened the icon and saved it (even without changes), I can not use the icon as intended.
If an existing icon to a button, it fits nicely into the button as it should. I open the icon and find it is a standard 32x32 icon and save it as a new icon (with or without changes). If I then use the new icon on the same button, the icon is way too big to fit.
Can anybody explain what is different about this new icon that it no longer fits? Is there a recommended tool that I should now be using to create my icons?
Thanks.
db
|
|
|
|
|
hi, anyone out there help me with a c# project, trying to write code involving methods and if else statments - beginners stuff
i'm confused can pay for your time
|
|
|
|
|
1) Rather than paying someone for their time, why not get a book?
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
|
You'd get a better response if you post a question here with the problem you encountered on your code.
|
|
|
|
|
Exactly, if it';s beginenr stuff, just post the code and probably somebody'll pick it up...
|
|
|
|
|
hi all,
this days ,i make Assemby ide , but i hae a probem with the resered words to be highlighted ,i want an effectie way to highlight the selected words
thanks
|
|
|
|
|
|
hi all,
this days ,i make Assemby ide , but i hae a probem with the resered words to be highlighted ,i want an effectie way to highlight the selected words
thanks
|
|
|
|
|
Hi all,
Just a quick question, I have a console application that I must launch and redirect output, so that I can parse its output. I am currenly using a Process object, setting the StartInfo.CreateNoWindow to true, not using ShellExecute and also redirecting standard output.
Under win2k+, no output window is displayed, under win9x/ME, an MSDOS window is displayed (for no reason, as output is already redirected to my application). So the DOS box has nothing in it.
So the question is...
Is there any way for me to get the DOS window to stay tucked away under win9x?
Any advice would be appreciated. Thanks.
--
Rob Hutchinson - Software Architect.
|
|
|
|
|
Windows and Windows NT are much different. Expect different behavior. In Windows (vs. Windows NT), the command shell works much differently (Windows is, after all, based on DOS). In Window NT, the console process can inherit settings - in a way - from the running application. This isn't so in Windows.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
So there is no way for me to remove that window?
--
Rob Hutchinson - Software Architect.
|
|
|
|
|
Maybe you could do a ::FindWindow() and minimize/hide it using the window handle..?
--
So let's just walk from place to place, as long as we don't talk face to face.
|
|
|
|
|
I didnt think of that, I'll give it a go.
Thanks.
--
Rob Hutchinson - Software Architect.
|
|
|
|
|
How can i build an own filedialog with a picture preview in C#?
|
|
|
|