PC Review


Reply
Thread Tools Rate Thread

Displaying different forms as startsup Object- vb 2005

 
 
Maverick
Guest
Posts: n/a
 
      30th Jul 2009
Hi Everyone,
I am facing an issue, hope if any of you guys could help me out.
My application have form 1,2 and 3, In some cases my application
starts up with form 1 and there are certaining cases where I have to
skip form 1 (and its functionality) and display from 2 as start up
object.

To overcome come this,I unchecked the "Enables application framework"
checkbox and start my project from sub Main in Module.
Now I am facing another issue in this approach is that before calling
to any form if I display any message to user by MessageBox.Show
("text") method application appears on taskbar with vs project default
icon (Icon that appears if we dont mention any icon for our project in
Project properties). Similarly on ALT+Tab combination default icon
appear in place of my application icon.

Can you help me how to overcome this and what would be the best
approach in my case to alter the form display sequence.

Regards,
Haroon.
 
Reply With Quote
 
 
 
 
Aaron
Guest
Posts: n/a
 
      5th Aug 2009



"Maverick" <(E-Mail Removed)> wrote in message
news:e4a6bf62-a0b1-47c2-9a49-(E-Mail Removed)...
> Hi Everyone,
> I am facing an issue, hope if any of you guys could help me out.
> My application have form 1,2 and 3, In some cases my application
> starts up with form 1 and there are certaining cases where I have to
> skip form 1 (and its functionality) and display from 2 as start up
> object.
>
> To overcome come this,I unchecked the "Enables application framework"
> checkbox and start my project from sub Main in Module.


This tells me that you are using VB as your language. Also you did not need
to do this.
If you wanted to change the startup form at runtime you can do this with the
application framework enabled.
It would be done through the StartUpEvent.

> Now I am facing another issue in this approach is that before calling
> to any form if I display any message to user by MessageBox.Show
> ("text") method application appears on taskbar with vs project default
> icon (Icon that appears if we dont mention any icon for our project in
> Project properties). Similarly on ALT+Tab combination default icon
> appear in place of my application icon.


AFAIK you cannot use MessageBox and still have an application icon show up
in the title bar.
What you would need to do is create your own form to show in this case.

Dim MyMessageBoxForm as new frmMessage()
MyMessageBoxForm.ShowDialog()


>
> Can you help me how to overcome this and what would be the best
> approach in my case to alter the form display sequence.



<STAThread()> _
Public Shared Sub Main()

Dim FormToChoose As Integer = 1

Dim frmTemp As Windows.Forms.Form = Nothing
Dim MyMessageBoxForm as new frmMessage()



Select Case MyMessageBoxForm.ShowDialog()

Case 0
frmTemp = New Form1()

Case 1
frmTemp = New Form2()

Case 2
frmTemp = New Form3()

Case 3
frmTemp = New Form4()

End Select


Application.Run(frmTemp)

End Sub
>
> Regards,
> Haroon.


 
Reply With Quote
 
Aaron
Guest
Posts: n/a
 
      5th Aug 2009
I'd like to say sorry if my first reply was confusing, I was a little short
on time yesterday when I posted. I took some more time this morning and
finished what I would have done.

Here is the Sub Main class

Friend Class AppManager

<STAThread()> _
Public Shared Sub Main()

Dim MyMessageBoxForm As New MyMessage()


Dim frmTemp As Windows.Forms.Form = Nothing

Select Case MyMessageBoxForm.ShowDialog()

Case DialogResult.Abort
frmTemp = New Form1()

Case DialogResult.Cancel
frmTemp = New Form2()

Case DialogResult.Ignore
frmTemp = New Form3()

Case DialogResult.No
frmTemp = New Form4()

End Select


Application.Run(frmTemp)

End Sub
End Class

And since my reason was only to test I made another form to act as the
messagebox called MyMessage. This
form had 4 buttons on it. Clicking a button determines which form will be
the Main form. I just used the first 4 of the
DialogResult enums as flags to the main form to determine which one had been
choosen.

Public Class MyMessage

Private Sub ButtonClick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles _
Button1.Click, Button2.Click, Button3.Click, Button4.Click

Select Case Convert.ToInt32(DirectCast(sender,
Button).Name.Substring(6))
Case 1 'button1
'Form1 as startup form
Me.DialogResult = Windows.Forms.DialogResult.Abort

Case 2 'button2
'Form2 as startup form
Me.DialogResult = Windows.Forms.DialogResult.Cancel

Case 3 'button3
'Form3 as startup form
Me.DialogResult = Windows.Forms.DialogResult.Ignore

Case 4 'button4
'Form4 as startup form
Me.DialogResult = Windows.Forms.DialogResult.No

End Select

Me.Close()


End Sub

End Class

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying different forms as startsup Object- vb 2005 Maverick Microsoft VB .NET 0 30th Jul 2009 12:45 PM
Displaying different forms as startsup Object- vb 2005 Maverick Microsoft Dot NET Framework Forms 0 30th Jul 2009 12:44 PM
Error displaying the win form designer in VS 2005, Events cannot be set on the object passed ... Rubens Microsoft Dot NET Framework Forms 0 27th Aug 2006 06:06 PM
VS 2005 B2: Object Reference not set to an Instance of an object Michael D. Ober Microsoft Dot NET 0 8th Jun 2005 10:04 PM
Access 2000 Forms Image Object not displaying correctly Tony Mongiello Microsoft Access 0 6th Oct 2004 04:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:22 AM.