Click here to Skip to main content
15,879,348 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
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
Updated 15-Dec-12 1:42am
v5

Have a look at this: Form.ShowDialog[^]. You should be able to accomplish this after reading that.
 
Share this answer
 
Comments
bikramjeet.sm 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    
http://tinypic.com/
bikramjeet.sm 11-Dec-12 13:57pm    
http://oi50.tinypic.com/m7fie.jpg
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.
bikramjeet.sm 11-Dec-12 14:11pm    
I want to use that code on Main Form Load event?
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.
C#
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.
C#
private void child1Button_Click(object sender, EventArgs e)
 {
   Form2 testDialog = new Form2();
   testDialog.Show();
 }
 
Share this answer
 
v2
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.
 
Share this answer
 
Comments
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
bikramjeet.sm 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)



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