Click here to Skip to main content
15,890,185 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi,

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

coding for skip button:
VB
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



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:-
MSIL
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




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.
Posted

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
 
Share this answer
 
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.
 
Share this answer
 
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()


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.
 
Share this answer
 
Hi

You can set property of pmain.Dock to Fill, it will solve your problem.

C++
frmmain.pmain.Dock = System.Windows.Forms.DockStyle.Fill


You can set it in design mode also.

Try it and let me know if any problem there.

:)
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900