Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't see radiobuttons on windows form in groupbox 1

Status
Not open for further replies.

jmarkus

Technical User
Oct 15, 2002
124
0
0
CA
I am trying to modify a form created in VB by someone else. I don't have Windows Form Designer or any other visual form editing software, I am doing it in code only.

I added a GroupBox and 2 radiobuttons inside the group box, but I can't see them. If I put the drawing.point below the form, I can see them. It is as if the GroupBox is opaque and is hiding the radiobuttons. How can I fix this?

The elements on the form I am concerned with are at the bottom of the code snippet, I just wanted to show the top to hopefully put it in context:

Code:
Public Class Form1
    	Inherits System.Windows.Forms.Form

	#Region " Windows Form Designer generated code "

    	Public Sub New()

        'Add any initialization after the InitializeComponent() call

        	MyBase.New()

        	'This call is required by the Windows Form Designer.
        	InitializeComponent()

	        'Add any initialization after the InitializeComponent() call

	End Sub

	'Form overrides dispose to clean up the component list.
    	Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        	If disposing Then
            		If Not (components Is Nothing) Then
                		components.Dispose()
            		End If
        	End If
        	MyBase.Dispose(disposing)
    	End Sub

    	'Required by the Windows Form Designer
    	Private components As System.ComponentModel.IContainer
...
... additional stuff for the form here
...
...
...
groupBox5.Controls.Add(me.radioBtnNX85)
		groupBox5.Controls.Add(me.radioBtnNX8)
		groupBox5.Controls.Add(radioBtnNX8)
		groupBox5.Controls.Add(radioBtnNX85)

			groupBox5.Location = New System.Drawing.Point(40, 400)
			groupBox5.Size = New System.Drawing.Size(500, 50)
			groupBox5.Text = "NX VERSION"
	
		    Me.radioBtnNX8.Location = New System.Drawing.Point(45, 425)
    		Me.radioBtnNX8.Size = New System.Drawing.Size(250, 17)
    		Me.radioBtnNX8.Text = "NX 8"
	
			Me.radioBtnNX85.Location = New System.Drawing.Point(230, 425)
    		Me.radioBtnNX85.Size = New System.Drawing.Size(250, 17)
    		Me.radioBtnNX85.Text = "NX 8.5"
			
		me.radioBtnNX8.checked=true
Thanks,
Jeff
 

Could you show the code for how you are creating the radio buttons and the group box, and how you are adding the group box to the form?

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Here's the whole form Private Sub, hopefully it shows what you are looking for:

Code:
Private Sub InitializeComponent()

		me.groupBox1 = New System.Windows.Forms.GroupBox()
		me.groupBox2 = New System.Windows.Forms.GroupBox()
		me.groupBox3 = New System.Windows.Forms.GroupBox()
		me.groupBox4 = New System.Windows.Forms.GroupBox()
		me.groupBox5 = New System.Windows.Forms.GroupBox()
     	me.radioButton2 = New System.Windows.Forms.RadioButton()
    	me.radioButton1 = New System.Windows.Forms.RadioButton()
		me.radioButton3 = New System.Windows.Forms.RadioButton()
		me.radioBtnNX85 = New System.Windows.Forms.RadioButton()
		me.radioBtnNX8 = New System.Windows.Forms.RadioButton()
		me.cbox1 = New System.Windows.Forms.CheckBox()
		me.cbox2 = New System.Windows.Forms.CheckBox()
		me.cbox3 = New System.Windows.Forms.CheckBox()
		me.cbox4 = New System.Windows.Forms.CheckBox()
		me.cbox5 = New System.Windows.Forms.CheckBox()
		me.cbox6 = New System.Windows.Forms.CheckBox()
		me.cbox7 = New System.Windows.Forms.CheckBox()
		me.cbox8 = New System.Windows.Forms.CheckBox()
		me.cbox9 = New System.Windows.Forms.CheckBox()
		me.cbox10 = New System.Windows.Forms.CheckBox()
		Me.Button1 = New System.Windows.Forms.Button() 
		Me.Button2 = New System.Windows.Forms.Button()
		Me.Button3 = New System.Windows.Forms.Button()
		me.lbox= new System.Windows.Forms.Listbox()  
		me.lbox2= new System.Windows.Forms.Listbox()
		me.label1= new System.Windows.Forms.Label()
		me.label2= new System.Windows.Forms.Label()

 		groupBox1.Controls.Add(me.radioButton2)
    	groupBox1.Controls.Add(me.radioButton1)
		groupBox1.Controls.Add(radioButton1)
    		groupBox1.Location = New System.Drawing.Point(190, 20)
    		groupBox1.Size = New System.Drawing.Size(300, 90)
    		groupBox1.Text = "Assembly Load Options"
			
			Me.radioButton2.Location = New System.Drawing.Point(200, 60)
    		Me.radioButton2.Size = New System.Drawing.Size(250, 17)
    		Me.radioButton2.Text = "Search Part's Folder and Subdirectories"

    		Me.radioButton1.Location = New System.Drawing.Point(200, 40)
    		Me.radioButton1.Name = "radioButton1"
    		Me.radioButton1.Size = New System.Drawing.Size(250, 17)
    		Me.radioButton1.Text = "As Saved"
	
    		Me.radioButton3.Location = New System.Drawing.Point(200, 80)
    		Me.radioButton3.Size = New System.Drawing.Size(280, 17)
    		Me.radioButton3.Text = "Search Part's PROJECT Folder and Subdirectories"
		me.radiobutton3.checked=true

		groupBox2.Controls.Add(me.cbox1)
    		groupBox2.Controls.Add(me.cbox2)
		groupBox2.Controls.Add(cbox3)
		groupBox2.Controls.Add(cbox4)
		groupBox2.Controls.Add(cbox5)
		groupBox2.Controls.Add(cbox5)
    		groupBox2.Location = New System.Drawing.Point(40, 20)
    		groupBox2.Size = New System.Drawing.Size(140, 150)
    		groupBox2.Text = "Export File Types"
    		
		Me.cBox1.Location = New System.Drawing.Point(50, 40)
        	Me.CBox1.Size = New System.Drawing.Size(120, 17)
        	Me.cBox1.Text = "STEP (.stp)"
		if not file.exists(stp_exp)
			Me.cBox1.enabled = False
			Me.cBox1.checked = False
		end if

		Me.cBox2.Location = New System.Drawing.Point(50, 60)
        	Me.CBox2.Size = New System.Drawing.Size(120, 17)
        	Me.cBox2.Text = "IGES (.igs)"
		if not file.exists(igs_exp)
			Me.cBox2.enabled = False
			Me.cBox2.checked = False
		end if

		Me.cBox3.Location = New System.Drawing.Point(50, 80)
        	Me.CBox3.Size = New System.Drawing.Size(120, 17)
        	Me.cBox3.Text = "JT (.jt)"
		if not file.exists(jt_exp)
			Me.cBox3.enabled = False
			Me.cBox3.checked = False
		end if

		Me.cBox4.Location = New System.Drawing.Point(50, 100)
        	Me.CBox4.Size = New System.Drawing.Size(120, 17)
        	Me.cBox4.Text = "Parasolid (.x_t)"

		Me.cBox5.Location = New System.Drawing.Point(50, 120)
        	Me.CBox5.Size = New System.Drawing.Size(120, 17)
        	Me.cBox5.Text = "Plot/PDF (.plt/.pdf)"
 
		Me.cBox6.Location = New System.Drawing.Point(50, 140)
        	Me.CBox6.Size = New System.Drawing.Size(128, 17)
        	Me.cBox6.Text = "DCS Log (-filelog.txt)"

		Me.cBox7.Location = New System.Drawing.Point(225, 115)
        	Me.CBox7.Size = New System.Drawing.Size(200, 23)
		Me.cBox7.Text = "Compress Exported Files"
        	Me.cBox7.Checked = True
		if not file.exists(seven_zip)
			Me.cBox7.enabled = False
			Me.cBox7.checked = False
		end if

		Me.cBox8.Location = New System.Drawing.Point(225, 140)
        	Me.CBox8.Size = New System.Drawing.Size(200, 23)
		Me.cBox8.Text = "Generate File List for Transmittal"
        	Me.cBox8.Checked = False

		Me.cBox9.Location = New System.Drawing.Point(225, 165)
        	Me.CBox9.Size = New System.Drawing.Size(250, 23)
		Me.cBox9.Text = "Sheet"
        	Me.cBox9.Checked = false
			
		Me.cBox10.Location = New System.Drawing.Point(225, 190)
        	Me.CBox10.Size = New System.Drawing.Size(300, 30)
		Me.cBox10.Text = "Split"
        	Me.cBox10.Checked = false

		Me.lbox.Location = New System.Drawing.Point(230, 240)
        	Me.lbox.Size = New System.Drawing.Size(300, 110)
		me.lbox.horizontalscrollbar=true
		me.lbox.selectionmode=selectionmode.multiextended

		Me.lbox2.Location = New System.Drawing.Point(50, 200)
        	Me.lbox2.Size = New System.Drawing.Size(60, 180)
		me.lbox2.horizontalscrollbar=true
		me.lbox2.selectionmode=selectionmode.multiextended
		for i as integer = 1 to 254
			me.lbox2.items.add(i)
		next
		

		Me.label1.Location = New System.Drawing.Point(115, 210)
        	Me.label1.Name = "Button1"
        	Me.label1.Size = New System.Drawing.Size(90, 23)
        	Me.label1.TabIndex = 1
        	Me.label1.Text = "Selected Layers:"

		Me.label2.Location = New System.Drawing.Point(115, 235)
        	Me.label2.Name = "Button1"
        	Me.label2.Size = New System.Drawing.Size(90, 150)
        	Me.label2.TabIndex = 1
        	Me.label2.Text = "1"

		groupBox3.Controls.Add(me.lbox2)
    		groupBox3.Controls.Add(me.label1)
		groupBox3.Controls.Add(me.label2)
    		groupBox3.Location = New System.Drawing.Point(40, 180)
    		groupBox3.Size = New System.Drawing.Size(170, 210)
    		groupBox3.Text = "Export Layers"

        	Me.Button1.Location = New System.Drawing.Point(220, 460)
        	Me.Button1.Name = "Button1"
        	Me.Button1.Size = New System.Drawing.Size(96, 23)
        	Me.Button1.TabIndex = 1
        	Me.Button1.Text = "Export"

		Me.Button2.Location = New System.Drawing.Point(230, 355)
        	Me.Button2.Name = "Button1"
        	Me.Button2.Size = New System.Drawing.Size(96, 23)
        	Me.Button2.TabIndex = 1
        	Me.Button2.Text = "Add File(s)"

		Me.Button3.Location = New System.Drawing.Point(330, 355)
        	Me.Button3.Name = "Button1"
        	Me.Button3.Size = New System.Drawing.Size(96, 23)
        	Me.Button3.TabIndex = 1
        	Me.Button3.Text = "Remove File(s)"

		groupBox4.Controls.Add(me.lbox)
    		groupBox4.Controls.Add(me.Button2)
		groupBox4.Controls.Add(me.Button3)
    		groupBox4.Location = New System.Drawing.Point(220, 220)
    		groupBox4.Size = New System.Drawing.Size(320, 170)
    		groupBox4.Text = "Files to Export"
			
    	groupBox5.Controls.Add(me.radioBtnNX85)
		groupBox5.Controls.Add(me.radioBtnNX8)
		groupBox5.Controls.Add(radioBtnNX8)
		groupBox5.Controls.Add(radioBtnNX85)

			groupBox5.Location = New System.Drawing.Point(40, 400)
			groupBox5.Size = New System.Drawing.Size(500, 50)
			groupBox5.Text = "NX VERSION"
	
		    Me.radioBtnNX8.Location = New System.Drawing.Point(45, 425)
    		Me.radioBtnNX8.Size = New System.Drawing.Size(250, 17)
    		Me.radioBtnNX8.Text = "8"
	
			Me.radioBtnNX85.Location = New System.Drawing.Point(230, 425)
    		Me.radioBtnNX85.Size = New System.Drawing.Size(250, 17)
    		Me.radioBtnNX85.Text = "8.5"
			
		me.radioBtnNX8.checked=true
			
        	Me.SuspendLayout()

        	Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        	Me.ClientSize = New System.Drawing.Size(550, 500)
        	Me.Controls.AddRange(New System.Windows.Forms.Control() {me.label1,me.label2,me.lbox,me.lbox2, me.groupbox3, Me.Button1, me.button2, me.button3, me.groupbox4, Me.cBox1, me.cbox2,Me.cBox3, me.cbox4, me.cbox5,me.cbox6,me.cbox7,me.cbox8,me.cbox9,me.cbox10,Me.radiobutton1, Me.radiobutton2, Me.radiobutton3,me.groupbox1, me.groupbox2, me.groupbox5, me.radioBtnNX85, me.radioBtnNX8})
        	Me.Name = "Form1"
        	Me.Text = "Title"
        	Me.ResumeLayout(False)
		Me.Controlbox=false
		me.topmost=true
		me.StartPosition=FormStartPosition.CenterScreen
		me.lbox2.setselected(0,True)

    	End Sub

Thanks,
Jeff
 
Did you try:

[pre]
With Me.radioButton1
.Location = New System.Drawing.Point(200, 40)
.Name = "radioButton1"
.Size = New System.Drawing.Size(250, 17)
.Text = "As Saved"[red]
.Visible = True[/red]
End With[/pre]

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.
 
Andy,

I should have specified the radiobuttons in question are the ones in GroupBox5.

But I'm afraid that variation of the code didn't make a difference when I applied it to them.

Jeff
 
VB.NET 2010
This code places groupBox5 on the Form, and radioBtnNX85 on the GroupBox groupBox5:

Code:
Dim groupBox5 As New GroupBox
Dim radioBtnNX85 As New RadioButton

groupBox5.Text = "My Group Box 5"
radioBtnNX85.Text = "radioBtnNX85"

Me.Controls.Add(groupBox5)
groupBox5.Controls.Add(radioBtnNX85)

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.
 
That seems to work for one, but as soon as I try to add the other "radioBtnNX8" I get neither.

Jeff
 
OK, 2 radio buttons:

Code:
Dim groupBox5 As New GroupBox
Dim radioBtnNX85 As New RadioButton[blue]
Dim radioBtnNX88 As New RadioButton[/blue]

groupBox5.Text = "My Group Box 5"
radioBtnNX85.Text = "radioBtnNX85"
radioBtnNX85.Location = New System.Drawing.Point(20, 20)
[blue]
radioBtnNX88.Text = "radioBtnNX88"
radioBtnNX88.Location = New System.Drawing.Point(20, 40)
[/blue]
Me.Controls.Add(groupBox5)
groupBox5.Controls.Add(radioBtnNX85)[blue]
groupBox5.Controls.Add(radioBtnNX88)[/blue]

Is it possible you place the radio buttons outside the boundary of the Group Box?

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.
 
Nope, that didn't work either.

What's strange is I have 3 radio buttons in GroupBox1 (see above), and they show up just fine. There must be some small obvious thing that I am missing, but I can't figure it out.

Jeff
 
Since I still don't have a solution, I was wondering if there was any kind of "debugging" procedure I could follow - since I don't have Microsoft Visual Studio. Or is there another open source or freeware program out there that can help me create the proper code for the Windows Form I am trying to create.

Thanks,
Jeff
 
You may want to try (free) Visual Studio Express

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.
 
Okay, I've got Visual Studio Express 2013 installed. I created a new class and copied my code into it. Now how do I work "visually" with it? Or am I going about this the wrong way?

Code:
Imports Microsoft.VisualBasic

Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()

        'Add any initialization after the InitializeComponent() call

        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.

    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Button2 As System.Windows.Forms.Button
    Friend WithEvents Button3 As System.Windows.Forms.Button
    Friend WithEvents groupBox1 As System.Windows.Forms.GroupBox
    Friend WithEvents groupBox2 As System.Windows.Forms.GroupBox
    Friend WithEvents groupBox3 As System.Windows.Forms.GroupBox
    Friend WithEvents groupBox4 As System.Windows.Forms.GroupBox
    Friend WithEvents groupBox5 As System.Windows.Forms.GroupBox
    Friend WithEvents radioButton1 As System.Windows.Forms.radioButton
    Friend WithEvents radioButton2 As System.Windows.Forms.radioButton
    Friend WithEvents radioButton3 As System.Windows.Forms.radioButton
    Friend WithEvents radioBtnNX8 As System.Windows.Forms.radioButton
    Friend WithEvents radioBtnNX85 As System.Windows.Forms.radioButton
    Friend WithEvents cbox1 As System.Windows.Forms.checkbox
    Friend WithEvents cbox2 As System.Windows.Forms.checkbox
    Friend WithEvents cbox3 As System.Windows.Forms.checkbox
    Friend WithEvents cbox4 As System.Windows.Forms.checkbox
    Friend WithEvents cbox5 As System.Windows.Forms.checkbox
    Friend WithEvents cbox6 As System.Windows.Forms.checkbox
    Friend WithEvents cbox7 As System.Windows.Forms.checkbox
    Friend WithEvents cbox8 As System.Windows.Forms.checkbox
    Friend WithEvents cbox9 As System.Windows.Forms.checkbox
    Friend WithEvents cbox10 As System.Windows.Forms.checkbox
    Friend WithEvents lbox As System.Windows.Forms.listbox
    Friend WithEvents lbox2 As System.Windows.Forms.listbox
    Friend WithEvents label1 As System.Windows.Forms.label
    Friend WithEvents label2 As System.Windows.Forms.label

    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

        Me.groupBox1 = New System.Windows.Forms.GroupBox()
        Me.groupBox2 = New System.Windows.Forms.GroupBox()
        Me.groupBox3 = New System.Windows.Forms.GroupBox()
        Me.groupBox4 = New System.Windows.Forms.GroupBox()
        Me.groupBox5 = New System.Windows.Forms.GroupBox()
        Me.radioButton2 = New System.Windows.Forms.RadioButton()
        Me.radioButton1 = New System.Windows.Forms.RadioButton()
        Me.radioButton3 = New System.Windows.Forms.RadioButton()
        Me.radioBtnNX85 = New System.Windows.Forms.RadioButton()
        Me.radioBtnNX8 = New System.Windows.Forms.RadioButton()
        Me.cbox1 = New System.Windows.Forms.CheckBox()
        Me.cbox2 = New System.Windows.Forms.CheckBox()
        Me.cbox3 = New System.Windows.Forms.CheckBox()
        Me.cbox4 = New System.Windows.Forms.CheckBox()
        Me.cbox5 = New System.Windows.Forms.CheckBox()
        Me.cbox6 = New System.Windows.Forms.CheckBox()
        Me.cbox7 = New System.Windows.Forms.CheckBox()
        Me.cbox8 = New System.Windows.Forms.CheckBox()
        Me.cbox9 = New System.Windows.Forms.CheckBox()
        Me.cbox10 = New System.Windows.Forms.CheckBox()
        Me.Button1 = New System.Windows.Forms.Button()
        Me.Button2 = New System.Windows.Forms.Button()
        Me.Button3 = New System.Windows.Forms.Button()
        Me.lbox = New System.Windows.Forms.Listbox()
        Me.lbox2 = New System.Windows.Forms.Listbox()
        Me.label1 = New System.Windows.Forms.Label()
        Me.label2 = New System.Windows.Forms.Label()

        groupBox1.Controls.Add(Me.radioButton2)
        groupBox1.Controls.Add(Me.radioButton1)
        groupBox1.Controls.Add(radioButton1)
        groupBox1.Location = New System.Drawing.Point(190, 20)
        groupBox1.Size = New System.Drawing.Size(300, 90)
        groupBox1.Text = "Assembly Load Options"

        Me.radioButton2.Location = New System.Drawing.Point(200, 60)
        Me.radioButton2.Size = New System.Drawing.Size(250, 17)
        Me.radioButton2.Text = "Search Part's Folder and Subdirectories"

        Me.radioButton1.Location = New System.Drawing.Point(200, 40)
        Me.radioButton1.Name = "radioButton1"
        Me.radioButton1.Size = New System.Drawing.Size(250, 17)
        Me.radioButton1.Text = "As Saved"

        Me.radioButton3.Location = New System.Drawing.Point(200, 80)
        Me.radioButton3.Size = New System.Drawing.Size(280, 17)
        Me.radioButton3.Text = "Search Part's PROJECT Folder and Subdirectories"
        Me.radiobutton3.checked = True

        groupBox2.Controls.Add(Me.cbox1)
        groupBox2.Controls.Add(Me.cbox2)
        groupBox2.Controls.Add(cbox3)
        groupBox2.Controls.Add(cbox4)
        groupBox2.Controls.Add(cbox5)
        groupBox2.Controls.Add(cbox5)
        groupBox2.Location = New System.Drawing.Point(40, 20)
        groupBox2.Size = New System.Drawing.Size(140, 150)
        groupBox2.Text = "Export File Types"

        Me.cBox1.Location = New System.Drawing.Point(50, 40)
        Me.CBox1.Size = New System.Drawing.Size(120, 17)
        Me.cBox1.Text = "STEP (.stp)"
        If Not file.exists(stp_exp) Then
            Me.cBox1.enabled = False
            Me.cBox1.checked = False
        End If

        Me.cBox2.Location = New System.Drawing.Point(50, 60)
        Me.CBox2.Size = New System.Drawing.Size(120, 17)
        Me.cBox2.Text = "IGES (.igs)"
        If Not file.exists(igs_exp) Then
            Me.cBox2.enabled = False
            Me.cBox2.checked = False
        End If

        Me.cBox3.Location = New System.Drawing.Point(50, 80)
        Me.CBox3.Size = New System.Drawing.Size(120, 17)
        Me.cBox3.Text = "JT (.jt)"
        If Not file.exists(jt_exp) Then
            Me.cBox3.enabled = False
            Me.cBox3.checked = False
        End If

        Me.cBox4.Location = New System.Drawing.Point(50, 100)
        Me.CBox4.Size = New System.Drawing.Size(120, 17)
        Me.cBox4.Text = "Parasolid (.x_t)"

        Me.cBox5.Location = New System.Drawing.Point(50, 120)
        Me.CBox5.Size = New System.Drawing.Size(120, 17)
        Me.cBox5.Text = "Plot/PDF (.plt/.pdf)"

        Me.cBox6.Location = New System.Drawing.Point(50, 140)
        Me.CBox6.Size = New System.Drawing.Size(128, 17)
        Me.cBox6.Text = "DCS Log (-filelog.txt)"

        Me.cBox7.Location = New System.Drawing.Point(225, 115)
        Me.CBox7.Size = New System.Drawing.Size(200, 23)
        Me.cBox7.Text = "Compress Exported Files"
        Me.cBox7.Checked = True
        If Not file.exists(seven_zip) Then
            Me.cBox7.enabled = False
            Me.cBox7.checked = False
        End If

        Me.cBox8.Location = New System.Drawing.Point(225, 140)
        Me.CBox8.Size = New System.Drawing.Size(200, 23)
        Me.cBox8.Text = "Generate File List for Transmittal"
        Me.cBox8.Checked = False

        Me.cBox9.Location = New System.Drawing.Point(225, 165)
        Me.CBox9.Size = New System.Drawing.Size(250, 23)
        Me.cBox9.Text = "Export Sheet Bodies (STP/IGS/Parasolid)"
        Me.cBox9.Checked = False

        Me.cBox10.Location = New System.Drawing.Point(225, 190)
        Me.CBox10.Size = New System.Drawing.Size(300, 30)
        Me.cBox10.Text = "Split DWG CAD LH/RH (ONLY works if drawing file is linked to BOTH LH+RH parts)"
        Me.cBox10.Checked = False

        Me.lbox.Location = New System.Drawing.Point(230, 240)
        Me.lbox.Size = New System.Drawing.Size(300, 110)
        Me.lbox.horizontalscrollbar = True
        Me.lbox.selectionmode = selectionmode.multiextended

        Me.lbox2.Location = New System.Drawing.Point(50, 200)
        Me.lbox2.Size = New System.Drawing.Size(60, 180)
        Me.lbox2.horizontalscrollbar = True
        Me.lbox2.selectionmode = selectionmode.multiextended
        For i As Integer = 1 To 254
            Me.lbox2.items.add(i)
        Next


        Me.label1.Location = New System.Drawing.Point(115, 210)
        Me.label1.Name = "Button1"
        Me.label1.Size = New System.Drawing.Size(90, 23)
        Me.label1.TabIndex = 1
        Me.label1.Text = "Selected Layers:"

        Me.label2.Location = New System.Drawing.Point(115, 235)
        Me.label2.Name = "Button1"
        Me.label2.Size = New System.Drawing.Size(90, 150)
        Me.label2.TabIndex = 1
        Me.label2.Text = "1"

        groupBox3.Controls.Add(Me.lbox2)
        groupBox3.Controls.Add(Me.label1)
        groupBox3.Controls.Add(Me.label2)
        groupBox3.Location = New System.Drawing.Point(40, 180)
        groupBox3.Size = New System.Drawing.Size(170, 210)
        groupBox3.Text = "Export Layers"

        Me.Button1.Location = New System.Drawing.Point(220, 460)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(96, 23)
        Me.Button1.TabIndex = 1
        Me.Button1.Text = "Export"

        Me.Button2.Location = New System.Drawing.Point(230, 355)
        Me.Button2.Name = "Button1"
        Me.Button2.Size = New System.Drawing.Size(96, 23)
        Me.Button2.TabIndex = 1
        Me.Button2.Text = "Add File(s)"

        Me.Button3.Location = New System.Drawing.Point(330, 355)
        Me.Button3.Name = "Button1"
        Me.Button3.Size = New System.Drawing.Size(96, 23)
        Me.Button3.TabIndex = 1
        Me.Button3.Text = "Remove File(s)"

        groupBox4.Controls.Add(Me.lbox)
        groupBox4.Controls.Add(Me.Button2)
        groupBox4.Controls.Add(Me.Button3)
        groupBox4.Location = New System.Drawing.Point(220, 220)
        groupBox4.Size = New System.Drawing.Size(320, 170)
        groupBox4.Text = "Files to Export"

        groupBox5.Controls.Add(Me.radioBtnNX85)
        groupBox5.Controls.Add(Me.radioBtnNX8)
        'groupBox5.Controls.Add(radioBtnNX8)
        'groupBox5.Controls.Add(radioBtnNX85)

        groupBox5.Location = New System.Drawing.Point(40, 400)
        groupBox5.Size = New System.Drawing.Size(500, 50)
        groupBox5.Text = "NX VERSION"

        Me.radioBtnNX8.Location = New System.Drawing.Point(45, 425)
        Me.radioBtnNX8.Size = New System.Drawing.Size(195, 17)
        Me.radioBtnNX8.Text = "NX 8"

        Me.radioBtnNX85.Location = New System.Drawing.Point(230, 425)
        Me.radioBtnNX85.Size = New System.Drawing.Size(250, 17)
        Me.radioBtnNX85.Text = "NX 8.5"


        Me.radioBtnNX8.checked = True

        Me.SuspendLayout()

        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(550, 500)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.label1, Me.label2, Me.lbox, Me.lbox2, Me.groupbox3, Me.Button1, Me.button2, Me.button3, Me.groupbox4, Me.cBox1, Me.cbox2, Me.cBox3, Me.cbox4, Me.cbox5, Me.cbox6, Me.cbox7, Me.cbox8, Me.cbox9, Me.cbox10, Me.radiobutton1, Me.radiobutton2, Me.radiobutton3, Me.groupbox1, Me.groupbox2, Me.groupbox5, Me.radioBtnNX85, Me.radioBtnNX8})
        '***
        Me.Controls.Add(groupBox5)
        groupBox5.Controls.Add(radioBtnNX85)
        'groupBox5.Controls.Add(radioBtnNX8) 
        '***
        Me.Name = "Form1"
        Me.Text = "MTC NX Batch Export"
        Me.ResumeLayout(False)
        Me.Controlbox = False
        Me.topmost = True
        Me.StartPosition = FormStartPosition.CenterScreen
        Me.lbox2.setselected(0, True)

    End Sub

#End Region

    Private Sub lBox2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lBox2.SelectedIndexChanged
        lstr = ""
        If lbox2.selecteditems.count = 0 Then
            lbox2.setselected(0, True)
        End If
        ReDim llst(lbox2.selecteditems.count - 1)
        For i As Integer = 0 To lbox2.selecteditems.count - 1
            lstr = lstr + lbox2.selecteditems(i).tostring + ", "
            llst(i) = lbox2.selecteditems(i).tostring
        Next

        lstr = strings.left(lstr, lstr.length - 2)
        label2.text = lstr
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim fstr() As String = file.readalllines(EXPDAT)
        If fstr(0) = "1" And Me.cbox1.enabled Then cbox1.checked = True
        If fstr(1) = "1" And Me.cbox2.enabled Then cbox2.checked = True
        If fstr(2) = "1" And Me.cbox3.enabled Then cbox3.checked = True
        If fstr(3) = "1" Then cbox4.checked = True
        If fstr(4) = "1" Then cbox5.checked = True
        If fstr(6) = "1" Then cbox6.checked = True
        console.write("Program Loaded" + VBCRLF + VBCRLF)
    End Sub


    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim fstr() As String = file.readalllines(EXPDAT)
        If ((cbox1.checked Or cbox2.checked Or cbox3.checked Or cbox4.checked Or cbox5.checked Or cbox6.checked Or cbox8.checked) And lbox.items.count > 0) Then
            fstr(0) = CType(-CType(cbox1.checked, Integer), String)
            fstr(1) = CType(-CType(cbox2.checked, Integer), String)
            fstr(2) = CType(-CType(cbox3.checked, Integer), String)
            fstr(3) = CType(-CType(cbox4.checked, Integer), String)
            fstr(4) = CType(-CType(cbox5.checked, Integer), String)
            fstr(6) = CType(-CType(cbox6.checked, Integer), String)
            fstr(7) = CType(-CType(cbox7.checked, Integer), String)

            If Me.radiobutton1.checked = True Then
                fstr(5) = "1"
            ElseIf Me.radiobutton2.checked = True Then
                fstr(5) = "2"
            ElseIf Me.radiobutton3.checked = True Then
                fstr(5) = "3"
            End If

            'Check for version
            If Me.radiobtnNX8.checked = True Then
                NXversion = 8
            ElseIf Me.radiobtnNX85.checked = True Then
                NXversion = 85
            End If

            file.WriteAllLines(EXPDAT, fstr)
            lbox.items.copyto(prts, 0)
            If cbox8.checked Then
                efl = 1
            End If

            If cbox9.checked Then
                sts = 1
                stprd(16) = "MODULES_MASK=Solids,Surfaces,Wireframe"
                igsrd(48) = "UGI_SOLID_MASK=Solid Bodies,Sheet Bodies"
            Else
                sts = 0
                stprd(16) = "MODULES_MASK=Solids,Wireframe"
                igsrd(48) = "UGI_SOLID_MASK=Solid Bodies"
            End If
            file.writealllines(stpdef, stprd)
            file.writealllines(igsdef, igsrd)

            ReDim Preserve prts(lbox.items.count - 1)

            If cbox10.checked Then
                splt = 1
            End If
            Me.Close()
        Else
            msgbox("Choose Export Type and Files to Export")
        End If
    End Sub


    Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim fdlg As OpenFileDialog = New OpenFileDialog()
        fdlg.autoupgradeenabled = False
        If dir = "" Then
            fdlg.InitialDirectory = Initdir
        Else
            fdlg.initialdirectory = dir
        End If
        fdlg.multiselect = True
        fdlg.Filter = "Part Files (*.prt)|*.prt"
        Dim fils() As String
        If fdlg.ShowDialog() = DialogResult.OK Then
            fils = fdlg.FileNames
            Me.lbox.items.addrange(fils)
            dir = System.IO.Path.GetDirectoryName(fils(0))
        End If

    End Sub

    Private Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
        While lbox.SelectedItems.Count > 0
            lbox.Items.Remove(lBox.SelectedItem)
        End While
    End Sub
End Class
 
Question: is there a reason why you do all controls creation in code?

I usually just place them on the Form at design time, unless I don't know how many controls I will need, then I do create them at run time.

But it looks to me you know exactly what controls you need, how many, and where to place them.

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.
 
The code I am trying to work with was created by someone who no longer works with my company. He somehow coded it from an existing form, and I thought I could just modify his code to add 2 radio buttons. Until you pointed out Visual Studio Express, I didn't know there was a free option to work with a "design view". I've now got a project running fine in Visual Studio Express, except when I go to "View Designer" <SHIFT+F7>, I get:

Code:
The designer could not be shown for this file because none of the classes within it can be designed.    
 
Instances of this error (1)  
 
1.   Hide Call Stack 
 
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.EnsureDocument(IDesignerSerializationManager manager)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host)

And I can't use/see the designer. (My only class is the Form class)

Thanks,
Jeff
 
Okay, I solved the original problem. Andy was right (start to you), I had added the groupBox5.Controls.Add(radioBtnNX85) after the Me.Controls.Add(groupBox5) and that screwed everything up.

It would still be nice to figure out how to get this to show up in forms designer, but I'll leave that for another post, another day.

Thanks,
Jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top