Flag Viewer

coding help

Page 1 of 1

4 Replies - 7512 Views - Last Post: 28 January 2009 - 08:58 AM Rate Topic: -----

#1 obas  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 27-January 09

Flag Viewer

Post icon  Posted 27 January 2009 - 12:44 PM

I am trying to create a program in VB 2008 express that displays flags (a flag viewer).

Currently I have two group boxes. Inside groupbox named "Country" I have 4 radio boxes (usa, japan, Canada, mexico)

I have a picture box with with the Usa flag in it.

I am trying to get it so when I click on these radio buttons the coresponding flag shows up.

So here is my naming scheme

USA (radio button) = UsaFlg (in the name field)
Picturebox with the USA flag = (name field) is UsFlag

So I double click on the USA radio button to get to the coding page and have tried various types of code such as


Private Sub UsaFlg_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UsaFlg.CheckedChanged

UsaFlg_CheckedChanged = UsaFlg




End Sub

What am I doing wrong. I know it appears to not like checked change and its not a check box its a radiobox.

So I tried

Radiobutton. X = (but not sure what to do from here)

Thanks

This post has been edited by obas: 27 January 2009 - 12:45 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Flag Viewer

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Flag Viewer

Posted 27 January 2009 - 12:46 PM

Moved to VB.NET :)
Was This Post Helpful? 0
  • +
  • -

#3 ZRonZ  Icon User is offline

  • D.I.C Head

Reputation: 28
  • View blog
  • Posts: 206
  • Joined: 09-January 09

Re: Flag Viewer

Posted 27 January 2009 - 08:13 PM

View Postobas, on 27 Jan, 2009 - 11:44 AM, said:

I am trying to create a program in VB 2008 express that displays flags (a flag viewer).

Currently I have two group boxes. Inside groupbox named "Country" I have 4 radio boxes (usa, japan, Canada, mexico)

I have a picture box with with the Usa flag in it.

I am trying to get it so when I click on these radio buttons the coresponding flag shows up.

So here is my naming scheme

USA (radio button) = UsaFlg (in the name field)
Picturebox with the USA flag = (name field) is UsFlag

So I double click on the USA radio button to get to the coding page and have tried various types of code such as


Private Sub UsaFlg_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UsaFlg.CheckedChanged

UsaFlg_CheckedChanged = UsaFlg


End Sub

What am I doing wrong. I know it appears to not like checked change and its not a check box its a radiobox.

So I tried

Radiobutton. X = (but not sure what to do from here)

Thanks


First, why do you have the second group box? I can't see a need for it. The four radio buttons should all be in the same group box. (they would still work without a groupbox but don't get into that habit - you'll regret it later)

The easiest way to do this is to have 4 pictureboxes, one set up with each flag. You can stack them on top of each other if you want the flag to show in the same place all the time. Since the radio buttons allow you to chose only one at a time you're going to only display one flag at a time hance stacking them.

Then to display the appropriate flag, work with the visible property of the picturebox within the checkedchanged for the radio button for that flag. You'll also need to hide the flags you don't want showing.

That should give you enough to work with to get the code going.
Was This Post Helpful? 0
  • +
  • -

#4 obas  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 27-January 09

Re: Flag Viewer

Posted 28 January 2009 - 08:25 AM

sorry forgot the other combo box. The other combo box will have three check boxes in it. They will say title, Display and something else (I don't remember off hand). Basically one box contains the 4 countrys the other box when selected will display info below that flag.


View PostZRonZ, on 27 Jan, 2009 - 07:13 PM, said:

View Postobas, on 27 Jan, 2009 - 11:44 AM, said:

I am trying to create a program in VB 2008 express that displays flags (a flag viewer).

Currently I have two group boxes. Inside groupbox named "Country" I have 4 radio boxes (usa, japan, Canada, mexico)

I have a picture box with with the Usa flag in it.

I am trying to get it so when I click on these radio buttons the coresponding flag shows up.

So here is my naming scheme

USA (radio button) = UsaFlg (in the name field)
Picturebox with the USA flag = (name field) is UsFlag

So I double click on the USA radio button to get to the coding page and have tried various types of code such as


Private Sub UsaFlg_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UsaFlg.CheckedChanged

UsaFlg_CheckedChanged = UsaFlg


End Sub

What am I doing wrong. I know it appears to not like checked change and its not a check box its a radiobox.

So I tried

Radiobutton. X = (but not sure what to do from here)

Thanks


First, why do you have the second group box? I can't see a need for it. The four radio buttons should all be in the same group box. (they would still work without a groupbox but don't get into that habit - you'll regret it later)

The easiest way to do this is to have 4 pictureboxes, one set up with each flag. You can stack them on top of each other if you want the flag to show in the same place all the time. Since the radio buttons allow you to chose only one at a time you're going to only display one flag at a time hance stacking them.

Then to display the appropriate flag, work with the visible property of the picturebox within the checkedchanged for the radio button for that flag. You'll also need to hide the flags you don't want showing.

That should give you enough to work with to get the code going.

Was This Post Helpful? 0
  • +
  • -

#5 Bort  Icon User is online

  • Ill-informed Mongoloid
  • member icon

Reputation: 405
  • View blog
  • Posts: 2,992
  • Joined: 18-September 06

Re: Flag Viewer

Posted 28 January 2009 - 08:58 AM

If RadioButton1.Checked = True Then

				  PictureBox1.Image = Application.StartUpPath & "\UsaFlag.gif"

End If



Try something like this.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1