|
Hi,
I would like to know, what are advantages and disadvantages of two template generators:
Guidance Automation Toolkit and Code Smith?
Is it better to develop templates using Code Smith or to develop packages with GAT?
What you think about this both tools?
Wojtek
|
|
|
|
|
Hello,
I am having diffiulty in calling a function from the parent form from the child form without having to create a new instance of the parent form.
Parent form spawns child which upon clicking of a button deletes a member from a database. What I need the button to do is to refresh a table on the parent form.
I have tried overriding refresh on the parent form but I still get the same issue: a nullpointerexception and the parent form is closed as well.
The code in the child form is this:
MessageBox.Show("Occurence Deleted!");
this.Parent.Refresh();
this.Close();
This is the override I have in the parent form:
public override void Refresh()
{
DataSet ds = eo.GetSearch();
dataGridView1.DataSource = ds;
dataGridView1.DataMember = "Employees";
}
The exception I am receiveing is:
A first chance exception of type 'System.NullReferenceException' occurred in Occurence Manager.exe
System.NullReferenceException: Object reference not set to an instance of an object.
(which is at the following line : this.Parent.Refresh();
What am I doing wrong?
|
|
|
|
|
First of all, I would call your refresh routine by a different name. Secondly, cast your Parent variable. So, suppose that your method was called RefreshData and the parent form was called MyParent, you would call it like this
((MyParent)this.Parent).RefreshData();
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I'm still having the same problem with the exception however. When I run the code in the parent form (via a refresh button) it runs just fine and does what it's supposed to do. I am trying to run this code in the child form after it makes edits to the database but unfortunately it still gives me an exception and closes the parent form.
could it be that the parent form (of the child in question) itself is passed a variable from a (grand?)parent form (the main form) and passes that variable into a protected variable upon initialization?
Here is the form in question expanded:
public partial class SearchWindow : Form
{
EmployeeObject eo;
DataSet ds = new DataSet();
public SearchWindow(EmployeeObject o)
{
InitializeComponent();
eo = o;
//RefreshData();
ds = eo.GetSearch();
dataGridView1.DataSource = ds;
dataGridView1.DataMember = "Employees";
}
public void RefreshData()
{
// ds = eo.GetSearch();
//dataGridView1.DataSource = ds;
//dataGridView1.DataMember = "Employees";
}
... and so on.
|
|
|
|
|
Sounds like you haven't set the parent of the child form then. The null reference obviously indicates this.Parent.RefreshData();
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I'm running into all sorts of trouble just to try to refresh a window. =)
Anyways I set the parent using this:
eef.Parent = this;
(eef being the instance of the child form)
then displayed it with eef.ShowDialog();
but unfortunately the window does not show and additionally it closes the parent form!
I get this exception: System.ArgumentException: Top-level control cannot be added to a control.
I can't do eef.ParentForm = this; because .ParentForm is read only.
I had assumed earlier however that when you instantiated a child form that it would automatically inherit the parent form.
|
|
|
|
|
I asked this question on the MSDN forums and this was the response:
Try setting the Owner property of the Dialog window:
using(frmMyDialog eef = new frmMyDialog())
{
eef.ShowDialog(this);
}
And in your dialog window:
(this.Owner as frmSearchWindow).RefreshData();
And it worked beautifully. =)
Apparently I needed to set the owner property instead of the parent property.
|
|
|
|
|
|
What is a "help privilege"?
|
|
|
|
|
Please don't send me emails; the forum is best for answering questions because others can then see the answer and benefit from it as well.
|
|
|
|
|
sorry i was mistraken,
anyway thnx for ur kind help
prashanth
|
|
|
|
|
How I can install programs from server to client using c#?
|
|
|
|
|
That's too broad of a question to give you any meaningful answer. If you need to do interprocess communication, look up .NET remoting. For installing stuff, potentially you could send the setup files across the pipe to the client, then the client could use System.Diagnostics.Process to launch the setup file. Most installers have a silent mode you can specify in the Process's arguments if you want the installer to run without intervention.
|
|
|
|
|
First, don't email me with questions. The forum is for questions; others can benefit from the answer you receive.
From the description you gave in the email, it sounds like you want to use ClickOnce technology, which provides auto and manual updates built-in: ClickOnce[^]. Deploy your software with ClickOnce, then use the System.Deployment APIs to update your application.
|
|
|
|
|
|
thanks for your pass,
I'll explain my question: suppose i have a program such as winzip program and i want to install it from my pc to another pc which connected to the same network, how i can do this without sending the program to the other pc.
more thanks again,,,
|
|
|
|
|
Hi,
How can i automaticly select and item in a listbox after i insert it?
<br />
lbLayouts.Items.Add("Layout " + lbLayouts.Items.Count+1); <br />
|
|
|
|
|
int index = lbLayouts.Items.Add("Layout " + lbLayouts.Items.Count+1);
lbLayouts.SelectedIndex = index;
|
|
|
|
|
Thank you very much!
Nuno
|
|
|
|
|
Problem Statement
How do I map multiple events to a single event handler?
Details
I have an MDI application and I would like to map a tree view item click to the same event handler for one of the items below the file menu, say filemenuitem. The tree view is a control within the MDI application.
Additionally, I would like one of the toolbars item clicks to map to the same.
Code Snippet/Others
Thanks in advance.
I am a SysAdmin, I battle my own daemons.
|
|
|
|
|
You do this by entering the name of the method that you call in the event handler link, e.g.:
myControl.Clicked += new EventHandler(MethodName);
You do this for both items.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hey,
When I write a file to my Harddisk and try to read (append) the next line (in my code) it craches. He says that the file doesn't exists... But when I wait 3-9sec it exists... How Can I for c# to immediatly write it on my Harddisk and not cache it our something?
thx!
|
|
|
|
|
It's very probably that you forgot to close your file before you tried to open it again. Can you show us the code?
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|
|
Code was inside "Using".
Works fine now
thx!
|
|
|
|
|
Hi
I want to create forms with glassy look and feel for that i want to change the shape of all controls like buttons, text box , and list controls , Menu. How can do it? As i have comeplted coding with all logics i want to write some global stuff for my project and apply it where ever i need by inheriting.
Its a windows based C# application....
Thanks.
|
|
|
|