Newsgroup: it.comp.programmare
Titolo: VB

Ciao a tutti...mi aiutate a modificare questo codice?
ho un Form
Private Sub CommandButton1_Click()
End Sub
Private Sub TextBox1_Change()
If TextBox1 = vbNullString Then Exit Sub
        If Not IsNumeric(TextBox1) Then
            MsgBox "INSERIRE SOLO VALORI NUMERICI"
            TextBox1 = vbNullString
        End If
End Sub
Private Sub TextBox2_Change()
If TextBox2 = vbNullString Then Exit Sub
        If Not IsNumeric(TextBox2) Then
            MsgBox "INSERIRE SOLO VALORI NUMERICI"
            TextBox2 = vbNullString
        End If
End Sub
e un Modulo
Sub CATMain()
Dim partDocument1 As PartDocument
Set partDocument1 = CATIA.ActiveDocument
Dim part1 As Part
Set part1 = partDocument1.Part
Dim bodies1 As Bodies
Set bodies1 = part1.Bodies
Dim body1 As Body
Set body1 = bodies1.Item("PartBody")
Dim sketches1 As Sketches
Set sketches1 = body1.Sketches
Dim originElements1 As OriginElements
Set originElements1 = part1.OriginElements
Dim reference1 As Reference
Set reference1 = originElements1.PlaneZX
Dim sketch1 As Sketch
Set sketch1 = sketches1.Add(reference1)
Dim arrayOfVariantOfDouble1(8)
arrayOfVariantOfDouble1(0) = 0#
arrayOfVariantOfDouble1(1) = 0#
arrayOfVariantOfDouble1(2) = 0#
arrayOfVariantOfDouble1(3) = -1#
arrayOfVariantOfDouble1(4) = 0#
arrayOfVariantOfDouble1(5) = 0#
arrayOfVariantOfDouble1(6) = 0#
arrayOfVariantOfDouble1(7) = 0#
arrayOfVariantOfDouble1(8) = 1#
Set sketch1Variant = sketch1
sketch1Variant.SetAbsoluteAxisData arrayOfVariantOfDouble1
part1.InWorkObject = sketch1
Dim factory2D1 As Factory2D
Set factory2D1 = sketch1.OpenEdition()
Dim geometricElements1 As GeometricElements
Set geometricElements1 = sketch1.GeometricElements
Dim axis2D1 As Axis2D
Set axis2D1 = geometricElements1.Item("Asse assoluto")
Dim line2D1 As Line2D
Set line2D1 = axis2D1.GetItem("Direzione H")
line2D1.ReportName = 1
Dim line2D2 As Line2D
Set line2D2 = axis2D1.GetItem("Direzione V")
line2D2.ReportName = 2
Dim point2D1 As Point2D
Set point2D1 = factory2D1.CreatePoint(-75#, 50#)
point2D1.ReportName = 3
Dim point2D2 As Point2D
Set point2D2 = factory2D1.CreatePoint(75#, 50#)
point2D2.ReportName = 4
Dim line2D3 As Line2D
Set line2D3 = factory2D1.CreateLine(-75#, 50#, 75#, 50#)
line2D3.ReportName = 5
line2D3.StartPoint = point2D1
line2D3.EndPoint = point2D2
Dim point2D3 As Point2D
Set point2D3 = factory2D1.CreatePoint(75#, -50#)
point2D3.ReportName = 6
Dim line2D4 As Line2D
Set line2D4 = factory2D1.CreateLine(75#, 50#, 75#, -50#)
line2D4.ReportName = 7
line2D4.EndPoint = point2D2
line2D4.StartPoint = point2D3
Dim point2D4 As Point2D
Set point2D4 = factory2D1.CreatePoint(-75#, -50#)
point2D4.ReportName = 8
Dim line2D5 As Line2D
Set line2D5 = factory2D1.CreateLine(75#, -50#, -75#, -50#)
line2D5.ReportName = 9
line2D5.StartPoint = point2D3
line2D5.EndPoint = point2D4
Dim line2D6 As Line2D
Set line2D6 = factory2D1.CreateLine(-75#, -50#, -75#, 50#)
line2D6.ReportName = 10
line2D6.EndPoint = point2D4
line2D6.StartPoint = point2D1
Dim constraints1 As Constraints
Set constraints1 = sketch1.Constraints
Dim reference2 As Reference
Set reference2 = part1.CreateReferenceFromObject(line2D3)
Dim reference3 As Reference
Set reference3 = part1.CreateReferenceFromObject(line2D1)
Dim constraint1 As Constraint
Set constraint1 = constraints1.AddBiEltCst(catCstTypeHorizontality,
reference2, reference3)
constraint1.Mode = catCstModeDrivingDimension
Dim reference4 As Reference
Set reference4 = part1.CreateReferenceFromObject(line2D5)
Dim reference5 As Reference
Set reference5 = part1.CreateReferenceFromObject(line2D1)
Dim constraint2 As Constraint
Set constraint2 = constraints1.AddBiEltCst(catCstTypeHorizontality,
reference4, reference5)
constraint2.Mode = catCstModeDrivingDimension
Dim reference6 As Reference
Set reference6 = part1.CreateReferenceFromObject(line2D4)
Dim reference7 As Reference
Set reference7 = part1.CreateReferenceFromObject(line2D2)
Dim constraint3 As Constraint
Set constraint3 = constraints1.AddBiEltCst(catCstTypeVerticality,
reference6, reference7)
constraint3.Mode = catCstModeDrivingDimension
Dim reference8 As Reference
Set reference8 = part1.CreateReferenceFromObject(line2D6)
Dim reference9 As Reference
Set reference9 = part1.CreateReferenceFromObject(line2D2)
Dim constraint4 As Constraint
Set constraint4 = constraints1.AddBiEltCst(catCstTypeVerticality,
reference8, reference9)
constraint4.Mode = catCstModeDrivingDimension
Dim reference10 As Reference
Set reference10 = part1.CreateReferenceFromObject(line2D5)
Dim constraint5 As Constraint
Set constraint5 = constraints1.AddMonoEltCst(catCstTypeLength,
reference10)
constraint5.Mode = catCstModeDrivingDimension
Dim length1 As Length
Set length1 = constraint5.Dimension
length1.Value = 150#
Dim reference11 As Reference
Set reference11 = part1.CreateReferenceFromObject(line2D6)
Dim constraint6 As Constraint
Set constraint6 = constraints1.AddMonoEltCst(catCstTypeLength,
reference11)
constraint6.Mode = catCstModeDrivingDimension
Dim length2 As Length
Set length2 = constraint6.Dimension
length2.Value = 100#
Dim reference12 As Reference
Set reference12 = part1.CreateReferenceFromObject(line2D1)
Dim reference13 As Reference
Set reference13 = part1.CreateReferenceFromObject(line2D3)
Dim constraint7 As Constraint
Set constraint7 = constraints1.AddBiEltCst(catCstTypeDistance,
reference12, reference13)
constraint7.Mode = catCstModeDrivingDimension
Dim length3 As Length
Set length3 = constraint7.Dimension
length3.Value = 50#
Dim reference14 As Reference
Set reference14 = part1.CreateReferenceFromObject(line2D4)
Dim reference15 As Reference
Set reference15 = part1.CreateReferenceFromObject(line2D2)
Dim constraint8 As Constraint
Set constraint8 = constraints1.AddBiEltCst(catCstTypeDistance,
reference14, reference15)
constraint8.Mode = catCstModeDrivingDimension
Dim length4 As Length
Set length4 = constraint8.Dimension
length4.Value = 75#
sketch1.CloseEdition
part1.InWorkObject = body1
part1.UpdateObject sketch1
part1.InWorkObject = body1
Dim shapeFactory1 As ShapeFactory
Set shapeFactory1 = part1.ShapeFactory
Dim pad1 As Pad
Set pad1 = shapeFactory1.AddNewPad(sketch1, 20#)
part1.UpdateObject pad1
Set partDocument1 = CATIA.ActiveDocument
partDocument1.SaveAs "C:\Documents and Settings\....\Desktop
\Implementazione_Catia\Part1.CATPart"
End Sub
come faccio a  far prendere il valore del textbox alle variabili:
constraint1
constraint2
Grazie

 
Se tu provassi a postare solo la porzione di codice significativa per il 
tuo problema piuttosto che tutto quanto il sorgente comprendente pure 
procedure vuote, inserendo pure qualche commento utile per capire che 
cosa succede (o che cosa dovrebbe succedere), magari qualcuno di buona 
volonta' disposto a darti una mano lo trovi anche, ma cosi'...