Click here to Skip to main content
13,249,504 members (56,792 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hello friend,

I need a help in what i want to do i did know how can i do that.


I have window application and i want to open one form like example image.
What I want to do now when user complete installation of my application on user system
the user can click on icon for run the application. There will be come Main Window form where user can able to tack access of all functions but when Main form will come out then i also want a Activation Form Open upon a Main from this form never hid close
till then user never Activate the Application with enter the code.
so how can i open Activation Form Open upon a Main from.

hope you my help me in it
Posted 11-Dec-12 8:13am
Updated 15-Dec-12 2:42am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Have a look at this: Form.ShowDialog[^]. You should be able to accomplish this after reading that.
Comments 11-Dec-12 13:23pm
i have a snap shot of example but i don't know how can i put that photo on codeproject
if you see that then you batter understand.
Adam R Harris 11-Dec-12 13:28pm 11-Dec-12 13:57pm
Adam R Harris 11-Dec-12 14:07pm
You are going to have to use ShowDialog, see the link I posted or the example from the link that jibesh posted. 11-Dec-12 14:11pm
I want to use that code on Main Form Load event?
Adam R Harris 11-Dec-12 14:15pm
Have you tried using that code on your form_load event and there is a problem?
Also if this helped please mark it as the accepted answer. 12-Dec-12 2:28am
i use that code but not working like that.
Adam R Harris 12-Dec-12 10:20am
Whats the problem? 13-Dec-12 1:16am
that widow not opening like that which i want 13-Dec-12 1:23am
I found a good example you can download this "window 7 logon background changer" and run it on your computer and click on setting button you can see the one windows come when you click on Setting i want to open form like this. setting window. I hope you will have a solution for that and also want to close MDI Child Form when user click on Cancel Button how now you can understand me...
Adam R Harris 13-Dec-12 11:16am
Sorry, but i'm not understanding what you are asking. I am not going to download some random program and run it just to see your example, my anti-virus would kick me in the balls. Can you please post a screen shot of what you are looking for? I see in another comment that you are running an MDI application which does change things. Are you wanting to block the entire application? i.e. the MDI Parent Window or just a MDI Window? 14-Dec-12 12:27pm
okay I'll 15-Dec-12 7:43am
Have a look on here
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

To display a child forms from your main application you have to first define your child forms in your application and call the following methods based on your need.
eg: This examples displays your child form as Model dialog which blocks the user to access the main form unless he/she close the child form.
 private void child1Button_Click(object sender, EventArgs e)
   Form2 testDialog = new Form2();
   // Show testDialog as a modal dialog and determine if DialogResult = OK. 
   if (testDialog.ShowDialog(this) == DialogResult.OK)
      //do success operation 
      // Child form is cancelled

To display your child as Modeless dialog.
private void child1Button_Click(object sender, EventArgs e)
   Form2 testDialog = new Form2();
Rate this: bad
Please Sign up or sign in to vote.

Solution 4

hi bikramjeet,
I got your problem. I also faced same problem while creating licensed application.Luckily i saw your problem.

I think following code ( will solve your problem

Dim frm As New frmLicense
    Private Sub MainForm_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated
        If Not frm.IsDisposed Then
        End If
    End Sub
    Private Sub MainForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        frm.TopMost = True
    End Sub

I have written simple code. frmlicense is your license activation popup form. I suggest make it singleton if u want. U can use any converter to get c# code. don't think its needed.

This will definitely solve your problem. If u find this suitable,accept as solution.So it will be helpful to other also.
amitnaik 20-Dec-12 11:05am
one more thing while closing do this close main form
U can use events of frmLicense. ( either by addhandler or using withevents keyword).

Private Sub frm_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles frm.FormClosed
Me.Close() 'Main form close
End Sub

wish u happy coding 23-Dec-12 11:32am
I have solve this too 5 after 3 day of posting but now i one thing left to solve
form is opening like i want but there is a issue of ALT+TAB i want to fix this too i mean i want to open that popup in form 1. when i use tab the popup always up with other runing application i want to open this popup form someting like this in this photo user hit on settig button and that setting will open end in same form.. i want to open popup form like this.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.171114.1 | Last Updated 20 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100