Click here to Skip to main content
15,924,367 members
Home / Discussions / C#
   

C#

 
Questionc# .net menu form like in codeproject.com Pin
sodevrom3-Nov-08 6:16
sodevrom3-Nov-08 6:16 
AnswerRe: c# .net menu form like in codeproject.com Pin
Pedram Behroozi3-Nov-08 6:51
Pedram Behroozi3-Nov-08 6:51 
GeneralRe: c# .net menu form like in codeproject.com Pin
sodevrom3-Nov-08 6:52
sodevrom3-Nov-08 6:52 
AnswerRe: c# .net menu form like in codeproject.com Pin
EliottA3-Nov-08 6:56
EliottA3-Nov-08 6:56 
GeneralRe: c# .net menu form like in codeproject.com Pin
sodevrom3-Nov-08 6:57
sodevrom3-Nov-08 6:57 
GeneralRe: c# .net menu form like in codeproject.com Pin
sodevrom3-Nov-08 7:07
sodevrom3-Nov-08 7:07 
QuestionHow to get Delete key to function in a PropertyGrid? Pin
bscaer3-Nov-08 5:52
bscaer3-Nov-08 5:52 
QuestionDataGridview column does not receive focus on form activation Pin
AndrusM3-Nov-08 5:44
AndrusM3-Nov-08 5:44 
To reproduce:

1. Run code.
2. Enter some data to grid
3. Click other form caption
4. Click original form caption
5. Enter some characters

Observed: entered characters are ignored

Expected: entered characters must appear in last active textbox

How to fix ?

Andrus.


using System.Windows.Forms;<br />
using System.Collections.Generic;<br />
using System;<br />
<br />
public class Test<br />
{<br />
    static void Main()<br />
    {<br />
        Application.Run(new MainForm());<br />
    }<br />
}<br />
<br />
class MainForm : Form<br />
{<br />
    public MainForm()<br />
    {<br />
        WindowState = FormWindowState.Maximized;<br />
        IsMdiContainer = true;<br />
        Form frm = new Childform();<br />
        frm.MdiParent = this;<br />
        frm.Show();<br />
        Form frm2 = new Childform();<br />
        frm2.MdiParent = this;<br />
        frm2.Show();<br />
        frm2.Left = 2000;<br />
    }<br />
}<br />
<br />
class Childform : Form<br />
{<br />
    DataGridView grid;<br />
    Control LastFocus = null;<br />
<br />
    public Childform()<br />
    {<br />
        ToolStripContainer tc = new ToolStripContainer();<br />
<br />
        grid = new DataGridView();<br />
        grid.Columns.Add(new DataGridViewTextBoxColumn());<br />
        grid.EditMode = DataGridViewEditMode.EditOnEnter;<br />
        grid.Top = 120;<br />
        grid.Height = 300;<br />
        Controls.Add(tc);<br />
        tc.ContentPanel.Controls.Add(new MyUserControl());<br />
<br />
        tc.ContentPanel.Controls.Add(grid);<br />
        this.Activated += new EventHandler(Childform_Activated);<br />
        this.Deactivate += new EventHandler(Childform_Deactivate);<br />
    }<br />
<br />
    void Childform_Activated(object sender, EventArgs e)<br />
    {<br />
        if (this.LastFocus != null)<br />
            this.LastFocus.Focus();<br />
    }<br />
<br />
    void Childform_Deactivate(object sender, EventArgs e)<br />
    {<br />
        this.LastFocus = this.ActiveControl;<br />
        while (LastFocus is IContainerControl)<br />
            LastFocus = ((IContainerControl)LastFocus).ActiveControl;<br />
    }<br />
}<br />
<br />
class MyUserControl : UserControl<br />
{<br />
    internal MyUserControl()<br />
    {<br />
        Height = 100;<br />
        Controls.Add(new TextBox());<br />
    }<br />
}


Andrus

QuestionBrowse For Folder Pin
Abdul Rahman Hamidy3-Nov-08 5:38
Abdul Rahman Hamidy3-Nov-08 5:38 
AnswerRe: Browse For Folder Pin
J4amieC3-Nov-08 6:03
J4amieC3-Nov-08 6:03 
AnswerRe: Browse For Folder Pin
Dave Kreskowiak3-Nov-08 6:12
mveDave Kreskowiak3-Nov-08 6:12 
QuestionRSS Feed Reader for .NET Windows Application Pin
saanj3-Nov-08 4:31
saanj3-Nov-08 4:31 
AnswerRe: RSS Feed Reader for .NET Windows Application Pin
Mircea Puiu3-Nov-08 4:41
Mircea Puiu3-Nov-08 4:41 
GeneralRe: RSS Feed Reader for .NET Windows Application Pin
saanj3-Nov-08 7:09
saanj3-Nov-08 7:09 
QuestionDymatic CheckBox in TableLayoutPanel Pin
yulien10203-Nov-08 4:15
yulien10203-Nov-08 4:15 
QuestionContextMenuStrip show problem Pin
josip cagalj3-Nov-08 4:11
josip cagalj3-Nov-08 4:11 
AnswerRe: ContextMenuStrip show problem Pin
Mircea Puiu3-Nov-08 4:38
Mircea Puiu3-Nov-08 4:38 
GeneralRe: ContextMenuStrip show problem Pin
josip cagalj3-Nov-08 20:07
josip cagalj3-Nov-08 20:07 
QuestionMerge dll files into one dll file Pin
Sami Sammour3-Nov-08 3:37
Sami Sammour3-Nov-08 3:37 
AnswerRe: Merge dll files into one dll file Pin
Dave Kreskowiak3-Nov-08 3:54
mveDave Kreskowiak3-Nov-08 3:54 
RantRe: Merge dll files into one dll file Pin
Paul Conrad3-Nov-08 4:57
professionalPaul Conrad3-Nov-08 4:57 
AnswerRe: Merge dll files into one dll file Pin
Giorgi Dalakishvili3-Nov-08 8:05
mentorGiorgi Dalakishvili3-Nov-08 8:05 
QuestionMaking Forms Work on Different Screen Resolutions Programatically... Pin
swjam3-Nov-08 1:52
swjam3-Nov-08 1:52 
AnswerRe: Making Forms Work on Different Screen Resolutions Programatically... Pin
EliottA3-Nov-08 1:54
EliottA3-Nov-08 1:54 
AnswerRe: Making Forms Work on Different Screen Resolutions Programatically... Pin
#realJSOP3-Nov-08 1:56
professional#realJSOP3-Nov-08 1:56 

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.