Click here to Skip to main content
15,914,608 members
Home / Discussions / C#
   

C#

 
GeneralRe: query dataset Pin
Paul Brower22-Jun-05 3:02
Paul Brower22-Jun-05 3:02 
GeneralRe: query dataset Pin
xrado22-Jun-05 3:17
xrado22-Jun-05 3:17 
GeneralRe: query dataset Pin
Paul Brower22-Jun-05 3:46
Paul Brower22-Jun-05 3:46 
GeneralRe: query dataset Pin
david cohoon22-Jun-05 7:55
david cohoon22-Jun-05 7:55 
GeneralRe: query dataset Pin
Anonymous22-Jun-05 8:08
Anonymous22-Jun-05 8:08 
GeneralC# MDI parent form & mdi form childs questions...urgent help please! Pin
GianlucaSeno22-Jun-05 0:49
GianlucaSeno22-Jun-05 0:49 
GeneralRe: C# MDI parent form & mdi form childs questions...urgent help please! Pin
sreejith ss nair22-Jun-05 2:57
sreejith ss nair22-Jun-05 2:57 
GeneralRe: C# MDI parent form & mdi form childs questions...urgent help please! Pin
GianlucaSeno22-Jun-05 3:42
GianlucaSeno22-Jun-05 3:42 
But if File menu has submenus...what event I've to set for him?

something like this...
void menuBuilder(object sender, System.EventArgs e)
{
MainMenu mainMenu = new MainMenu();
MenuItem file = new MenuItem();
file.MergeOrder=0;
file.MergeType=MenuMerge.MergeItems;
file.Text="&File";
file.Index=0;
file.Shortcut=Shortcut.CtrlF;
file.Click+=new EventHandler(file_Click);
mainMenu.MenuItems.Add(file);

MenuItem campionato = new MenuItem();
campionato.MergeOrder=1;
campionato.MergeType=MenuMerge.MergeItems;
campionato.Text="&Campionato";
campionato.Click += new EventHandler(Championship_Open);
campionato.Shortcut=Shortcut.CtrlC;
campionato.ShowShortcut=true;
file.MenuItems.Add(campionato);

this.Menu=mainMenu;
}

private void file_Click(object sender, EventArgs e)
{
}

Will works or...not?

For second question...probably I'm confused...
In brief...I've a MDI application with this MDI childs(at the moment all MDI childs are closed):
1)MDIFORM (MDI container)
2)FORM1 (MDI form child)
3)FORM2 (MDI form child)
I press a menu on MDIFORM that opens FORM1.

In FORM1 there is a texbox and 1 button(btnOk).
On keyPress event of textbox I write in a MSAccess DB what I'm writing in a table.
Then I press a button and on click event I call this method btnOk_Click:

public class FORM1: System.Windows.Forms.Form
{
private void btnOk_Click(object sender, System.EventArgs e)
{
FORM2 newMDIChild = new FORM2();
newMDIChild.MdiParent = this.MdiParent;
newMDIChild.Show();
}
}

In FORM2 I've a datagrid where I show results written before in last MSAccess table.The code is this:

public class FORM2 : System.Windows.Forms.Form
{
private System.ComponentModel.Container components = null;
private System.Windows.Forms.DataGrid dataPreResult;

public FORM2()
{
InitializeComponent();
}

protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
private void InitializeComponent()
{
this.dataPreResult = new System.Windows.Forms.DataGrid();
((System.ComponentModel.ISupportInitialize)(this.dataPreResult)).BeginInit();
this.SuspendLayout();
//
// dataPreResult
//
this.dataPreResult.AllowSorting = false;
this.dataPreResult.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.dataPreResult.DataMember = "";
this.dataPreResult.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataPreResult.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.dataPreResult.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataPreResult.Location = new System.Drawing.Point(0, 0);
this.dataPreResult.Name = "dataPreResult";
this.dataPreResult.ReadOnly = true;
this.dataPreResult.RowHeaderWidth = 10;
this.dataPreResult.Size = new System.Drawing.Size(232, 613);
this.dataPreResult.TabIndex = 0;
//
// FORM2
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(232, 613);
this.Controls.Add(this.dataPreResult);
this.Location = new System.Drawing.Point(600, 10);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FORM2";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Load += new System.EventHandler(this.StringPreResult_Load);
((System.ComponentModel.ISupportInitialize)(this.dataPreResult)).EndInit();
this.ResumeLayout(false);
}
#endregion

public void StringPreResult_Load(object sender, System.EventArgs e)
{
ReadResults();
}

public void ReadResults()
{
OleDbDataAdapter da = new OleDbDataAdapter();
OleDbConnection con =new OleDbConnection();
OleDbCommand cmd = new OleDbCommand();
DataTable dt =new DataTable();
dt.Clear();
con.ConnectionString=<connectionstring>;
con.Open();
cmd.Connection = con;
cmd.CommandText = "SELECT * FROM TABLE";

da.SelectCommand = cmd;
da.Fill(dt);

dataPreResult.SetDataBinding(dt,"");

cmd.Cancel();
con.Close();
}

}

So now, my problems are:
1)When I push another time btnOk on FORM1 another FORM2 is showed.How can open one window?
2)if when I push MDIFORM menu's, when I open FORM1, I'll open FORM2 too, how can update datagrid in FORM2 from FORM1 when i write on FORM1 textbox?

Thanks for any ideas! Big Grin | :-D
GeneralRe: C# MDI parent form &amp; mdi form childs questions...urgent help please! Pin
david cohoon22-Jun-05 7:19
david cohoon22-Jun-05 7:19 
GeneralRe: C# MDI parent form &amp; mdi form childs questions...urgent help please! Pin
GianlucaSeno22-Jun-05 7:42
GianlucaSeno22-Jun-05 7:42 
GeneralRe: C# MDI parent form &amp; mdi form childs questions...urgent help please! Pin
Anonymous22-Jun-05 11:18
Anonymous22-Jun-05 11:18 
GeneralPOS system Pin
Carl-Johan Larsson21-Jun-05 23:19
Carl-Johan Larsson21-Jun-05 23:19 
Generalcustom treeview structure Pin
deep721-Jun-05 23:16
deep721-Jun-05 23:16 
GeneralRe: custom treeview structure Pin
Dave Kreskowiak22-Jun-05 5:46
mveDave Kreskowiak22-Jun-05 5:46 
GeneralManipulate Windows Explorer folder properties dialog Pin
Ligblou21-Jun-05 23:03
Ligblou21-Jun-05 23:03 
GeneralRe: Manipulate Windows Explorer folder properties dialog Pin
Ligblou22-Jun-05 3:42
Ligblou22-Jun-05 3:42 
GeneralRe: Manipulate Windows Explorer folder properties dialog Pin
Dave Kreskowiak22-Jun-05 5:33
mveDave Kreskowiak22-Jun-05 5:33 
GeneralRe: Manipulate Windows Explorer folder properties dialog Pin
Ligblou22-Jun-05 22:11
Ligblou22-Jun-05 22:11 
GeneralRe: Manipulate Windows Explorer folder properties dialog Pin
Dave Kreskowiak22-Jun-05 5:28
mveDave Kreskowiak22-Jun-05 5:28 
GeneralRe: Manipulate Windows Explorer folder properties dialog Pin
Ligblou22-Jun-05 22:14
Ligblou22-Jun-05 22:14 
GeneralRichTextbox Problem Pin
heavenamour21-Jun-05 22:35
heavenamour21-Jun-05 22:35 
Generalsimple question or not Pin
raf9521-Jun-05 22:29
raf9521-Jun-05 22:29 
GeneralRe: simple question or not Pin
Sebastian Schneider21-Jun-05 23:21
Sebastian Schneider21-Jun-05 23:21 
GeneralC # chat Application Pin
idreesbadshah21-Jun-05 22:00
idreesbadshah21-Jun-05 22:00 
GeneralAdding handler to event without knowing it's name Pin
Piotrus21-Jun-05 21:57
Piotrus21-Jun-05 21:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.