Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# .NET
Hello friend,
 
I need a help in ado.net what i want to do i did know how can i do that.
 
http://oi50.tinypic.com/m7fie.jpg
 
Or
 
http://i48.tinypic.com/avhjti.png[^]
 
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
Thanks
Posted 11-Dec-12 8:13am
Edited 15-Dec-12 2:42am
v5
Rate this: bad
good
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.
  Permalink  
Comments
bikramjeet.sm at 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 at 11-Dec-12 13:28pm
   
http://tinypic.com/
bikramjeet.sm at 11-Dec-12 13:57pm
   
http://oi50.tinypic.com/m7fie.jpg
Adam R Harris at 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.
bikramjeet.sm at 11-Dec-12 14:11pm
   
I want to use that code on Main Form Load event?
Adam R Harris at 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.
bikramjeet.sm at 12-Dec-12 2:28am
   
i use that code but not working like that.
Adam R Harris at 12-Dec-12 10:20am
   
Whats the problem?
bikramjeet.sm at 13-Dec-12 1:16am
   
that widow not opening like that which i want
bikramjeet.sm at 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 at 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?
bikramjeet.sm at 14-Dec-12 12:27pm
   
okay I'll
bikramjeet.sm at 15-Dec-12 7:43am
   
Have a look on here http://i48.tinypic.com/avhjti.png
Rate this: bad
good
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 
   }
   else
   {
      // Child form is cancelled
   }
   testDialog.Dispose();
       
 }
 
To display your child as Modeless dialog.
private void child1Button_Click(object sender, EventArgs e)
 {
   Form2 testDialog = new Form2();
   testDialog.Show();
 }
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

Quote:
hi bikramjeet,
I got your problem. I also faced same problem while creating licensed application.Luckily i saw your problem.
 
I think following code (vb.net) 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
            frm.Focus()
        End If
    End Sub
 
    Private Sub MainForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        frm.TopMost = True
        frm.Show()
    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.
  Permalink  
Comments
amitnaik at 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
bikramjeet.sm at 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 http://i48.tinypic.com/avhjti.png 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
0 Sergey Alexandrovich Kryukov 269
1 OriginalGriff 240
2 CPallini 195
3 Maciej Los 177
4 BillWoodruff 173
0 OriginalGriff 5,655
1 DamithSL 4,506
2 Maciej Los 3,997
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,180


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 20 Dec 2012
Copyright © CodeProject, 1999-2014
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