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 MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

another vb question

Status
Not open for further replies.

tazengr

Mechanical
Joined
Mar 1, 2007
Messages
34
Location
DE
the tutorial i am going through is makes a user form with one combo box and two command buttons.

The combo box is a drop down menu that allows you to pick the material and the code matches that material with the appropriate density.

The two command buttons are "OK" and "cancel".


The code works fine but I am having trouble with the procedure for the OK command where it is supposed to convert the density from lbs/in^3 to kg/m^3

here is the procedure for the "OK" command button.

Private Sub cmdOK_Click()
Dim density As Double
'The required density is in kg/m^3
'so multiply by a scale factor
density = frmMaterials.cboMaterials.Column(1, frmMaterials.cboMaterials.ListIndex) * 27680
Part.SetUserPreferenceDoubleValue(swMaterialPropertyDensity, density)
End
End Sub

I get an error in the row that starts off with density.
Can someone help
thanks,


 
Whats the error? Difficult to tell without seeing the form. Have you tried another set of brackets as below?
density = frmMaterials.cboMaterials.Column((1, frmMaterials.cboMaterials.ListIndex) * 27680)

Dunno if this will help.

 
Taz,

What version of SW are you using? If older than 2006, there may be functions that are not supported. Also, it is difficult to answer your question without more details, as suggested by the Doctor's nemesis above.

Matt
CAD Engineer/ECN Analyst
Silicon Valley, CA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top