MDI问题(父子窗体) [英] Problem with MDI (Parent child form)

查看:58
本文介绍了MDI问题(父子窗体)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一份调查表.当我单击跳过"按钮时,它将把表单放到系统托盘中.

跳过按钮的编码:

Hi,

I have a survey form. When I click skip button, it will put the form to system tray.

coding for skip button:

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        'frmmain.pmain.Show()  ' asal
        Me.Close()
        Me.Hide()  ' add 10/02/11
        frmmain.pmain.Hide()
        frmmain.Hide()
        ' frmqlist.Show() ' del 10/02/1
    End Sub




当我双击系统托盘中的图标时,它会相应地显示一个窗体(Frmquestionnaire)(它在frmmain界面内的框架).但是它并没有如我所愿.

编码双击通知图标:-




When I double click icon from the system tray, it suppose to show a form(Frmquestionnaire) accordingly (it''s frame within the frmmain interface). However it didn''t show as what I wish.

coding double click notify icon:-

Private Sub NotifyIcon1_MouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseDoubleClick
       
        Me.Uptable()
      
    End Sub
   
    Public Sub Uptable()
        Dim rsx As OleDb.OleDbDataAdapter
        Dim dt As New DataTable("tbluser")
        Dim counter As Integer
        counter = 0
       
        rsx = New OleDb.OleDbDataAdapter("SELECT iduser FROM tbluser WHERE gender = 'male' or gender = 'female'", con)
        rsx.Fill(dt)
        Try
            counter = dt.Rows.Count
        Catch ex As Exception
        End Try
       
        If (counter = 1) Then
            Me.pmain.Hide()
            'frmqlist.Show()
            frmQuestionnaire.Show()
        Else
            Me.Show()
            Me.pmain.Show()
        End If

        rsx.Dispose()
        con.Close()
    End Sub





暂时,我已手动更改了表单的属性,以将这些功能控制箱上的false更改为false,将其最大化,最小化,显示在任务栏中,显示图标.我将文本设置为",将边框样式设置为none,以使其在用户查看时最适合.

请告诉我.

p/s:我在此​​群组中的第一个帖子.

谢谢大家.





For the time being, I have changed manually on the properties of the form to false on these features controlbox,maximize, minimize, shownintask bar, show icon. I set up text to """ and borderstyle to none to suit best when user view it.

Please advise me.

p/s : my first posting in this group.

Thank you folks.

推荐答案

我能给您的最佳建议:永远不要使用MDI!

在CodeProject上已多次给出此建议.
似乎没有人对此设计感到满意;这是非常不方便的.我不知道使用它的单个像样的或仅由专业编写的应用程序.

有很多更好的选项,例如单窗口选项卡式界面.

—SA
The best advice I can give you: never use MDI!

This recommendation was given many times on CodeProject.
It looks like no one is happy with this design; it is extremely inconvenient. I don''t know a single decent or just professionally written application which uses it.

There are many much better options, such as single-window tabbed interface.

—SA


在第一种情况下(Button3_Click),我不清楚我指的是什么.是主要形式的孩子(frmmain)的孩子吗?

您可以添加我在每个实例中所指的内容吗?这可能会清除一些问题.

无论哪种方式,您都关闭了我,所以如果Me.Uptable与您关闭的我相同,那么您将遇到问题.

如果这些是MDI表单,则只需要隐藏主要表单,而不是子表单.反之亦然...如果隐藏主窗体,则除非同时显示父窗体,否则显示子窗体不会显示它.

出于好奇...除了男性和女性之外,性别还有别的选择吗?我希望这可能是空白...

如果我是您,我会考虑使用ExecuteScalar而不是填写表格.您可以编写SQL来返回Count,然后使用ExecuteScalar,您不必创建表或DataAdapter.
I''m not clear what Me is referring to in the first case (Button3_Click). Is it a child of a child of a main form (frmmain)?

Can you add what Me refers to in each instance? That may clear some things up.

Either way, you closed Me, so if Me.Uptable is the same Me that you closed, you''re going to have problems.

And if these are MDI forms, you just need to hide the main form, not the children forms. The reverse is also true...if you hide the main form, showing a child form won''t show it unless you show the parent form as well.

As a curiosity...is there an option for gender besides male and female? I hope that means it could be blank...

And if I were you, I would look into using ExecuteScalar instead of filling a table. You can write your SQL to return a Count and then using ExecuteScalar you wouldn''t have to create a table or DataAdapter.


威廉,

此处的 me 是指Frmquestionnaire(单击跳过"按钮= Button3时)


对于此代码:-

Hi William,

The me there refer to Frmquestionnaire (Upon clicking SKIP button = Button3)


For this codes:-

Me.Close()
      Me.Hide()  
      frmmain.pmain.Hide()
      frmmain.Hide()



好的,我明白您的意思.

出于好奇...除了男性和女性外,性别还有别的选择吗?我希望这可能是空白...

对于这个,因为我不知道要放什么,所以我只想测试一个条件.请忍受我,因为我的编程不好.很抱歉给我带来麻烦

ExecuteScalar?我完全不知道那是什么,但是我会得到一些信息.

问题:

我遇到了问题,当我单击跳过"按钮(按钮3)时,它将把程序带到系统托盘.然后,我双击系统任务栏中的图标(上面的代码),它将显示frmQuestionnaire.Show().
但是,表格并不相应. (frmQuestionnaire不在frmmain界面的框架内.

图像如下所示:- http://cid-77fe20fabddbcb9e.photos.live .com/self.aspx/New%20album/wmYaCnWb.jpg [ ^ ]

我希望能从任何人那里得到一些建议.

非常感谢.



Ok I understand what you mean here.

As a curiosity...is there an option for gender besides male and female? I hope that means it could be blank...

For this one, Because I have no idea what to put so I just test to make a condition. Please bear with me as Im not good in programming . I am sorry for that trouble

ExecuteScalar? I am totally no idea what is that but I will get some info.

Problem:

I am facing problem, When I click skip button (Button 3) it will bring the program to system tray. Then I double click icon in system tray(Codes as above) it will show frmQuestionnaire.Show().
However the form is not accordingly. (The frmQuestionnaire is not in the frame within frmmain interface.

The image as shown here :- http://cid-77fe20fabddbcb9e.photos.live.com/self.aspx/New%20album/wmYaCnWb.jpg[^]

I hope to get some advise from anyone.

Thank so much.


这篇关于MDI问题(父子窗体)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆