Ad

Thursday, May 28, 2009

Add Point to Point Group – Part II

In the last post I provided code on the main part of the code to add a point to a point group. In this post I’ll post some of the steps to create a form that prompts the user for which point group they want to use. The first thing to do is create the form by going to Project on the Menu bar and choosing Add Windows Form.

image 

Then take items from the Toolbox and put it into the form. In my form I used a combo box to hold the list of point groups in the drawing. The button is used to give the user an opportunity to create a new point group.

image

Double clicking any of the buttons lets you go and modify the code. Each part of the form can get some code to do something. The code for this example is below:

   1: Public Class FrmPointGroup



   2:  



   3:     Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click



   4:         g_sName = ComboBox1.Text



   5:         Me.DialogResult = System.Windows.Forms.DialogResult.OK



   6:         Me.Close()



   7:     End Sub



   8:  



   9:     Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click



  10:         Me.DialogResult = System.Windows.Forms.DialogResult.Cancel



  11:         g_sName = "Canceled Entered Into Value"



  12:         Me.Close()



  13:     End Sub



  14:  



  15:     Private Sub FrmPointGroup_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load



  16:  



  17:     End Sub



  18:  



  19:     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click



  20:         Dim sName As String



  21:         sName = GetPointGroupName()



  22:         ComboBox1.Items.Add(sName)



  23:         ComboBox1.SelectedText = sName



  24:     End Sub



  25: End Class



Some of the code that fills up the combo box was in the other post. So now the code is compiled and is ready to go on the programming side. The compiled code may be downloaded here. In the next post I’ll add it to the right click menu in the cui.

No comments:

LinkWithin

Blog Widget by LinkWithin

Ad