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

A Few Questions/Advice for a Beginner

Status
Not open for further replies.

DubiumLibertas

Programmer
Jun 26, 2007
6
US
Hello there,

I apologize for asking such a newbie question in advance. I've been pouring over FAQ's here and everywhere in between and searched for a few hours and I can't seem to find anybody asking my question (probably because it's so basic it's universally understood!)

I am trying to write a program where the user must select from a combo box (drop down) a specific chip number (there are 27 choices.) I figured that out, I think. To the best of my knowledge, you just put:

ComboBoxName.AddItem "150", for example.

I have this under the Form_Load(). The problem is each chip from the dropdown box has different parameters where the user keys in information about it, to be saved to a txt file. I have all of that taken care of, but the program defaults to the first chip in the series (150) every time! I was thinking of maybe having a "splash screen" where the user must select the chipset before anything else, and then the related input fields pop up. After being frustrated and looking through every tutorial related to splash screens I could find, I gave up.

My question is this: What would be the easiest path for me to take here? Again, I apologize for the newbishness of the question and the length of the post. Any help or advice is greatly appreciated. Thanks in advance!
 
Add a blank entry in the combo box. Make it the first one so it will be selected by default.

Ex:

Code:
ComboBoxName.AddItem ""
ComboBoxName.AddItem "1"
ComboBoxName.AddItem "5"
ComboBoxName.AddItem "150"

-George

"the screen with the little boxes in the window." - Moron
 

In gmmastros' suggestion, user can always go back to an empty choice.

If you don't want it, you may do this:
Code:
With ComboBoxName
   .Clear
   .AddItem "1"
   .AddItem "5"
   .AddItem "150"
   ...
   .ListIndex = -1
End With

Have fun.

---- Andy
 
Just a minute...if you don't mind, I'd like to take a couple of steps backwards and verify what you're trying to do. You have a set of chips. You want to have these chipsets in a list box. The user selects one of the chipsets, at which point the user is to enter data specific to the selected set of chips. Is that the situation?

Now if it is the situation, a couple more questions: does each chip set have the same parameters associated with it, or do the parameters differ from set to set? If the latter, what is the minimum and the maximum number of parameters? Finally, how strongly do you need to validate the parameters that the user provides when selecting a chipset?

Thanks,

Bob
 
To answer your questions:

1. Yes, that's it in a nutshell.
2. The parameters differ from set to set.
3. Minimum number of parameters = 22. Maximum number of parameters = 41.
4. I don't need to validate the parameters that strongly. Nothing that makes it overcomplicated.

Screenshot of the ugly, errored form:
pic.php


I don't care how it looks, as long as it works. :) The thing I am having trouble with is how to update the paramaters based on what chip the user selects. Currently it just sits at 150 (although the arrows and the information therein seems to be working fine.)

Also, to clear things up a bit... this is how I have the parameters coded currently - they're using data structures that my boss made for me in the rough outline of the program.

ChipData(0).Setupdata(5).Name = "Maximum Feedrate"
ChipData(0).Setupdata(5).ValueDefault = 0#
ChipData(0).Setupdata(5).Value = ChipData(0).Setupdata(5).ValueDefault
ChipData(0).Setupdata(5).ValueCnt = 0
ChipData(0).Setupdata(5).UnitCnt = 1
ChipData(0).Setupdata(5).UnitList(0) = "Tons/hr"

That is part of Chip 150 (0 in the array list) -- there are 36 Setupdatas here. The last line there where it says "Tons/hr" is just the label -- it's getting the maximum feedrate number in tons per hour from the user, so that would be the input box. I hope this clears things up a bit and I thank you for your input. I'd be so lost if it wasn't for these forums.
 
Ok. I see why you're having trouble, but I don't get exactly how your data structures work. Can you post the Type definition, or are these really objects?

Bob
 
Hi Bob,

Thanks for replying. I'm not really sure what you mean by that question (sorry!) btu here is my Module with the data structures in it:

Option Explicit

Public Type SetupDataType
Name As String
Value As Double
ValueCnt As Long
ValueList(32) As String
ValueDefault As Double
Unit As String
UnitCnt As Long
UnitList(32) As String
End Type

Public Type ChipDataType
ChipName As String
MaxSetup As Long
Setupdata(64) As SetupDataType
End Type

Global ChipData(64) As ChipDataType
Global MaxChipNo As Long

Global sText As String

Global CurrentChipNo As Long
Global CurrentSetup As Long


 
Yes, that's what I'm looking for. Now, as I understand it, you are presently able to populate a listbox with Chipdata(0).ChipName, ChipData(1).ChipName, and so on, but you are unable to cause your program to react to user selections. Assuming that that is true, the next thing you need to do is interact with the Click event on your List box. What are you presently doing there?

 
I think I got that to work, but the entire window is not refreshing now. This is what I have for the click event:

Private Sub ChipNoBox_Click()
CurrentChipNo = ChipNoBox.ListIndex
sText = ChipNoBox.Text
Call FillScreen

The problem I am now encountering is what to do about making sure all the parameters are included if I select another chip from the listbox. I have a feeling that the error might be this bit of code:

ComboUnits.Clear
For i = 0 To .UnitCnt - 1
ComboUnits.AddItem .UnitList(i)
Next i
If ComboUnits.ListCount > 0 Then ComboUnits.ListIndex = 0



Do you think it would be easier to know what I'm doing wrong if I sent you the source code somehow? I am very gracious for your help thus far - thanks again!
 
Sure, post the source code here, but please omit any parts that aren't relevant to the problem domain as described. When you post code, put it between code tags if you don't mind (hit preview post and read the note at the bottom) so it's easier to read.
 
Alrighty, here is the source code for MainForm.frm:

Code:
Option Explicit

Private Sub Form_Load()
'Chip 150 = ChipNo 0
'Chip 230 = ChipNo 1
'Chip 310 = ChipNo 2
'Chip 410 = ChipNo 3
'Chip 511 = ChipNo 4
'Chip 610 = ChipNo 5
'Chip 710 = ChipNo 6
'Chip 810 = ChipNo 7
'Chip 910 = ChipNo 8
'Chip 1000 = ChipNo 9
'Chip 1100 = ChipNo 10
'Chip 1220 = ChipNo 11
'Chip 1300 = ChipNo 12
'Chip 1500 = ChipNo 13
'Chip 1600 = ChipNo 14
'Chip 1810 = ChipNo 15
'Chip 1900 = ChipNo 16
'Chip 2010 = ChipNo 17
'Chip 2101 = ChipNo 18
'Chip 2200 = ChipNo 19
'Chip 2300 = ChipNo 20
'Chip 2500 = ChipNo 21
'Chip 2600 = ChipNo 22
'Chip 3000 = ChipNo 23
'Chip 3110 = ChipNo 24
'Chip 3200 = ChipNo 25
'Chip 3400 = ChipNo 26
'Chip 3500 = ChipNo 27

   ChipNoBox.AddItem "150"
   ChipNoBox.AddItem "230"
   ChipNoBox.AddItem "310"
   ChipNoBox.AddItem "410"
   ChipNoBox.AddItem "511"
   ChipNoBox.AddItem "610"
   ChipNoBox.AddItem "710"
   ChipNoBox.AddItem "810"
   ChipNoBox.AddItem "910"
   ChipNoBox.AddItem "1000"
   ChipNoBox.AddItem "1100"
   ChipNoBox.AddItem "1220"
   ChipNoBox.AddItem "1300"
   ChipNoBox.AddItem "1500"
   ChipNoBox.AddItem "1600"
   ChipNoBox.AddItem "1810"
   ChipNoBox.AddItem "1900"
   ChipNoBox.AddItem "2010"
   ChipNoBox.AddItem "2101"
   ChipNoBox.AddItem "2200"
   ChipNoBox.AddItem "2300"
   ChipNoBox.AddItem "2500"
   ChipNoBox.AddItem "2600"
   ChipNoBox.AddItem "3000"
   ChipNoBox.AddItem "3110"
   ChipNoBox.AddItem "3200"
   ChipNoBox.AddItem "3400"
   ChipNoBox.AddItem "3500"

' Declare the variables
Dim lIndex As Long
' Fill the variables
sText = ChipNoBox.Text
lIndex = ChipNoBox.ListIndex + 1
' Display the message box
' MsgBox sText & ", item number " & lIndex & " is currently selected. "


Dim i As Long

'CurrentChipNo = 0
CurrentSetup = 0

ComPrevious.Caption = "<"
ComNext.Caption = ">"

Call FillScreen



End Sub

Private Sub ChipNoBox_Click()
  CurrentChipNo = ChipNoBox.ListIndex
  sText = ChipNoBox.Text
  Call FillScreen
End Sub

Private Sub ComNext_Click()

  If CurrentSetup < ChipData(CurrentChipNo).MaxSetup Then
    CurrentSetup = CurrentSetup + 1
  Else
    CurrentSetup = ChipData(CurrentChipNo).MaxSetup
  End If

  Call FillScreen

End Sub

Private Sub ComPrevious_Click()

  If CurrentSetup > 0 Then CurrentSetup = CurrentSetup - 1
  Call FillScreen


End Sub

Private Sub FillScreen()

Dim i As Integer

  With ChipData(CurrentChipNo).Setupdata(CurrentSetup)

    LabelNameData.Caption = .Name
  
  
    If .ValueCnt > 0 Then
      TextValue.Visible = False 'Shows/hides the text input box
      ComboValue.Visible = True 'Shows/hides the dropdown box
      ComboUnits.Visible = False 'Shows/hides the other dropbox

  
      ComboValue.Clear
      For i = 0 To .ValueCnt - 1
        ComboValue.AddItem .ValueList(i)
      Next i
      
      If .Value > 0 And .Value < .ValueCnt Then
        ComboValue.ListIndex = .Value
      Else
        ComboValue.ListIndex = 0
      End If
    Else
      TextValue.Visible = True
      ComboValue.Visible = False
      ComboUnits.Visible = True
  
      TextValue.Text = Format(.Value)
  

ComboUnits.Clear
For i = 0 To .UnitCnt - 1
  ComboUnits.AddItem .UnitList(i)
Next i
If ComboUnits.ListCount > 0 Then ComboUnits.ListIndex = 0





    End If

  End With

End Sub


Private Sub Form_Initialize()

  MaxChipNo = 1
  
  '**************************************************
  
  ChipData(0).ChipName = "D32400-150"
  ChipData(0).MaxSetup = 36
  
  ChipData(0).Setupdata(0).Name = "Feedrate Setpoint"
  ChipData(0).Setupdata(0).ValueDefault = 10#
  ChipData(0).Setupdata(0).Value = ChipData(0).Setupdata(0).ValueDefault
  ChipData(0).Setupdata(0).ValueCnt = 0
  ChipData(0).Setupdata(0).UnitCnt = 4
  ChipData(0).Setupdata(0).UnitList(0) = "Ton Per Hour"
  ChipData(0).Setupdata(0).UnitList(1) = "Lbs Per Hour"
  ChipData(0).Setupdata(0).UnitList(2) = "KG Per Hour"
  ChipData(0).Setupdata(0).UnitList(3) = "MTon Per Hour"
  
  ChipData(0).Setupdata(1).Name = "RPM"
  ChipData(0).Setupdata(1).ValueDefault = 1000#
  ChipData(0).Setupdata(1).Value = ChipData(0).Setupdata(1).ValueDefault
  ChipData(0).Setupdata(1).ValueCnt = 0
  ChipData(0).Setupdata(1).UnitCnt = 1
  ChipData(0).Setupdata(1).UnitList(0) = "RPM"
  
  ChipData(0).Setupdata(2).Name = "Initial Density Estimate"
  ChipData(0).Setupdata(2).ValueDefault = 50#
  ChipData(0).Setupdata(2).Value = ChipData(0).Setupdata(2).ValueDefault
  ChipData(0).Setupdata(2).ValueCnt = 0
  ChipData(0).Setupdata(2).UnitCnt = 2
  ChipData(0).Setupdata(2).UnitList(0) = "Lbs per Cubic feet"
  ChipData(0).Setupdata(2).UnitList(1) = "KG per Cubic meter"
  
  ChipData(0).Setupdata(3).Name = "Run Mode Select"
  ChipData(0).Setupdata(3).ValueDefault = 3#
  ChipData(0).Setupdata(3).Value = ChipData(0).Setupdata(3).ValueDefault
  ChipData(0).Setupdata(3).ValueCnt = 8
  ChipData(0).Setupdata(3).ValueList(0) = "0 (Feedrate Demand)"
  ChipData(0).Setupdata(3).ValueList(1) = "1 (Feedrate Up/Down)"
  ChipData(0).Setupdata(3).ValueList(2) = "2 (Feedrate Setpoint)"
  ChipData(0).Setupdata(3).ValueList(3) = "3 (RPM Demand)"
  ChipData(0).Setupdata(3).ValueList(4) = "4 (RPM Up/Down)"
  ChipData(0).Setupdata(3).ValueList(5) = "5 (RPM Setpoint)"
  ChipData(0).Setupdata(3).ValueList(6) = "6 (Feedrate Serial)"
  ChipData(0).Setupdata(3).ValueList(7) = "7 (RPM Serial)"
  ChipData(0).Setupdata(3).UnitCnt = 0
  
  ChipData(0).Setupdata(4).Name = "Feed Display Select"
  ChipData(0).Setupdata(4).ValueDefault = 0#
  ChipData(0).Setupdata(4).Value = ChipData(0).Setupdata(4).ValueDefault
  ChipData(0).Setupdata(4).ValueCnt = 5
  ChipData(0).Setupdata(4).ValueList(0) = "0 (U.S. Tons)"
  ChipData(0).Setupdata(4).ValueList(1) = "1 (Lbs)"
  ChipData(0).Setupdata(4).ValueList(2) = "2 (Metric Tons)"
  ChipData(0).Setupdata(4).ValueList(3) = "3 (Kgs)"
  ChipData(0).Setupdata(4).ValueList(4) = "4 (Kgs/sec)"
  ChipData(0).Setupdata(4).UnitCnt = 0
  
  ChipData(0).Setupdata(5).Name = "Maximum Feedrate"
  ChipData(0).Setupdata(5).ValueDefault = 0#
  ChipData(0).Setupdata(5).Value = ChipData(0).Setupdata(5).ValueDefault
  ChipData(0).Setupdata(5).ValueCnt = 0
  ChipData(0).Setupdata(5).UnitCnt = 1
  ChipData(0).Setupdata(5).UnitList(0) = "Tons/hr"
  
  ChipData(0).Setupdata(6).Name = "Minimum Feedrate"
  ChipData(0).Setupdata(6).ValueDefault = 0#
  ChipData(0).Setupdata(6).Value = ChipData(0).Setupdata(6).ValueDefault
  ChipData(0).Setupdata(6).ValueCnt = 0
  ChipData(0).Setupdata(6).UnitCnt = 1
  ChipData(0).Setupdata(6).UnitList(0) = "Tons/hr"
  
  ChipData(0).Setupdata(7).Name = "Totalizer Increment"
  ChipData(0).Setupdata(7).ValueDefault = 0#
  ChipData(0).Setupdata(7).Value = ChipData(0).Setupdata(7).ValueDefault
  ChipData(0).Setupdata(7).ValueCnt = 0
  ChipData(0).Setupdata(7).UnitCnt = 1
  ChipData(0).Setupdata(7).UnitList(0) = "Lbs"
  
  ChipData(0).Setupdata(8).Name = "Demand Mode"
  ChipData(0).Setupdata(8).ValueDefault = 0#
  ChipData(0).Setupdata(8).Value = ChipData(0).Setupdata(8).ValueDefault
  ChipData(0).Setupdata(8).ValueCnt = 2
  ChipData(0).Setupdata(8).ValueList(0) = "0 (Eddy Current Clutch)"
  ChipData(0).Setupdata(8).ValueList(1) = "1 (DC/Var Freq)"
  ChipData(0).Setupdata(8).UnitCnt = 0
  
  ChipData(0).Setupdata(9).Name = "Tachometer Type"
  ChipData(0).Setupdata(9).ValueDefault = 0#
  ChipData(0).Setupdata(9).Value = ChipData(0).Setupdata(9).ValueDefault
  ChipData(0).Setupdata(9).ValueCnt = 4
  ChipData(0).Setupdata(9).ValueList(0) = "0 (60-Pulses/Rev)"
  ChipData(0).Setupdata(9).ValueList(1) = "1 (40-Pulses/Rev)"
  ChipData(0).Setupdata(9).ValueList(2) = "2 (18-Pulses/Rev)"
  ChipData(0).Setupdata(9).ValueList(3) = "3 (12-Pulses/Rev)"
  
  ChipData(0).Setupdata(10).Name = "Weigh Span Length"
  ChipData(0).Setupdata(10).ValueDefault = 0#
  ChipData(0).Setupdata(10).Value = ChipData(0).Setupdata(10).ValueDefault
  ChipData(0).Setupdata(10).ValueCnt = 0
  ChipData(0).Setupdata(10).UnitCnt = 1
  ChipData(0).Setupdata(10).UnitList(0) = "Inches"
  
  ChipData(0).Setupdata(11).Name = "Weigh Span Volume"
  ChipData(0).Setupdata(11).ValueDefault = 0#
  ChipData(0).Setupdata(11).Value = ChipData(0).Setupdata(11).ValueDefault
  ChipData(0).Setupdata(11).ValueCnt = 0
  ChipData(0).Setupdata(11).UnitCnt = 1
  ChipData(0).Setupdata(11).UnitList(0) = "Cubic Feet"
  
  ChipData(0).Setupdata(12).Name = "Calibration Probe Span"
  ChipData(0).Setupdata(12).ValueDefault = 0#
  ChipData(0).Setupdata(12).Value = ChipData(0).Setupdata(12).ValueDefault
  ChipData(0).Setupdata(12).ValueCnt = 0
  ChipData(0).Setupdata(12).UnitCnt = 1
  ChipData(0).Setupdata(12).UnitList(0) = "Inches"

  ChipData(0).Setupdata(13).Name = "Calibration Weight"
  ChipData(0).Setupdata(13).ValueDefault = 0#
  ChipData(0).Setupdata(13).Value = ChipData(0).Setupdata(13).ValueDefault
  ChipData(0).Setupdata(13).ValueCnt = 0
  ChipData(0).Setupdata(13).UnitCnt = 1
  ChipData(0).Setupdata(13).UnitList(0) = "Lbs"
  
  ChipData(0).Setupdata(14).Name = "MSC Servo Loop Gain"
  ChipData(0).Setupdata(14).ValueDefault = 0#
  ChipData(0).Setupdata(14).Value = ChipData(0).Setupdata(14).ValueDefault
  ChipData(0).Setupdata(14).ValueCnt = 0
  ChipData(0).Setupdata(14).UnitCnt = 1
  ChipData(0).Setupdata(14).UnitList(0) = " "
  
  ChipData(0).Setupdata(15).Name = "MSC Servo Rate Feedback"
  ChipData(0).Setupdata(15).ValueDefault = 0#
  ChipData(0).Setupdata(15).Value = ChipData(0).Setupdata(15).ValueDefault
  ChipData(0).Setupdata(15).ValueCnt = 0
  ChipData(0).Setupdata(15).UnitCnt = 1
  ChipData(0).Setupdata(15).UnitList(0) = " "
  
  ChipData(0).Setupdata(16).Name = "Discharge Pluggage Delay"
  ChipData(0).Setupdata(16).ValueDefault = 0#
  ChipData(0).Setupdata(16).Value = ChipData(0).Setupdata(16).ValueDefault
  ChipData(0).Setupdata(16).ValueCnt = 0
  ChipData(0).Setupdata(16).UnitCnt = 1
  ChipData(0).Setupdata(16).UnitList(0) = "Sec"
  
  ChipData(0).Setupdata(17).Name = "Belt Motion Monitor Delay"
  ChipData(0).Setupdata(17).ValueDefault = 0#
  ChipData(0).Setupdata(17).Value = ChipData(0).Setupdata(17).ValueDefault
  ChipData(0).Setupdata(17).ValueCnt = 0
  ChipData(0).Setupdata(17).UnitCnt = 1
  ChipData(0).Setupdata(17).UnitList(0) = "Sec"
  
  ChipData(0).Setupdata(18).Name = "Level/Temperature Sensor Delay"
  ChipData(0).Setupdata(18).ValueDefault = 0#
  ChipData(0).Setupdata(18).Value = ChipData(0).Setupdata(18).ValueDefault
  ChipData(0).Setupdata(18).ValueCnt = 0
  ChipData(0).Setupdata(18).UnitCnt = 1
  ChipData(0).Setupdata(18).UnitList(0) = " "
  
  ChipData(0).Setupdata(19).Name = "Weigh Signal Feeder"
  ChipData(0).Setupdata(19).ValueDefault = 0#
  ChipData(0).Setupdata(19).Value = ChipData(0).Setupdata(19).ValueDefault
  ChipData(0).Setupdata(19).ValueCnt = 0
  ChipData(0).Setupdata(19).UnitCnt = 1
  ChipData(0).Setupdata(19).UnitList(0) = " "
  
  ChipData(0).Setupdata(20).Name = "Feedback Signal Filter"
  ChipData(0).Setupdata(20).ValueDefault = 0#
  ChipData(0).Setupdata(20).Value = ChipData(0).Setupdata(20).ValueDefault
  ChipData(0).Setupdata(20).ValueCnt = 0
  ChipData(0).Setupdata(20).UnitCnt = 1
  ChipData(0).Setupdata(20).UnitList(0) = " "
  
  ChipData(0).Setupdata(21).Name = "Feedback Filter Override Treshold"
  ChipData(0).Setupdata(21).ValueDefault = 0#
  ChipData(0).Setupdata(21).Value = ChipData(0).Setupdata(21).ValueDefault
  ChipData(0).Setupdata(21).ValueCnt = 0
  ChipData(0).Setupdata(21).UnitCnt = 1
  ChipData(0).Setupdata(21).UnitList(0) = " "
  
  ChipData(0).Setupdata(22).Name = "Simulation Travel"
  ChipData(0).Setupdata(22).ValueDefault = 0#
  ChipData(0).Setupdata(22).Value = ChipData(0).Setupdata(22).ValueDefault
  ChipData(0).Setupdata(22).ValueCnt = 0
  ChipData(0).Setupdata(22).UnitCnt = 1
  ChipData(0).Setupdata(22).UnitList(0) = "Revolutions"
  
  ChipData(0).Setupdata(23).Name = "Not Used"
  ChipData(0).Setupdata(23).ValueDefault = 0#
  ChipData(0).Setupdata(23).Value = ChipData(0).Setupdata(23).ValueDefault
  ChipData(0).Setupdata(23).ValueCnt = 0
  ChipData(0).Setupdata(23).UnitCnt = 1
  ChipData(0).Setupdata(23).UnitList(0) = "(Not Used)"
  
  ChipData(0).Setupdata(24).Name = "Belt Paddle Feedback Permissive"
  ChipData(0).Setupdata(24).ValueDefault = 0#
  ChipData(0).Setupdata(24).Value = ChipData(0).Setupdata(24).ValueDefault
  ChipData(0).Setupdata(24).ValueCnt = 2
  ChipData(0).Setupdata(24).ValueList(0) = "0 (Paddle Ignored)"
  ChipData(0).Setupdata(24).ValueList(1) = "1 (Paddle Enabled)"
  
  ChipData(0).Setupdata(25).Name = "Communcations Unit Number"
  ChipData(0).Setupdata(25).ValueDefault = 0#
  ChipData(0).Setupdata(25).Value = ChipData(0).Setupdata(25).ValueDefault
  ChipData(0).Setupdata(25).ValueCnt = 0
  ChipData(0).Setupdata(25).UnitCnt = 1
  ChipData(0).Setupdata(25).UnitList(0) = " "
  
  ChipData(0).Setupdata(26).Name = "Mode Select Enable/Disable"
  ChipData(0).Setupdata(26).ValueDefault = 0#
  ChipData(0).Setupdata(26).Value = ChipData(0).Setupdata(26).ValueDefault
  ChipData(0).Setupdata(26).ValueCnt = 5
  ChipData(0).Setupdata(26).ValueList(0) = "0 (Keyboard Only)"
  ChipData(0).Setupdata(26).ValueList(1) = "1 (Keyboard and Remote)"
  ChipData(0).Setupdata(26).ValueList(2) = "2 (Remote Only)"
  ChipData(0).Setupdata(26).ValueList(3) = "3 (Keyboard and Local)"
  ChipData(0).Setupdata(26).ValueList(4) = "4 (Keyboard and Jog)"
  
  ChipData(0).Setupdata(27).Name = "Remote FRI Frequency"
  ChipData(0).Setupdata(27).ValueDefault = 0#
  ChipData(0).Setupdata(27).Value = ChipData(0).Setupdata(27).ValueDefault
  ChipData(0).Setupdata(27).ValueCnt = 0
  ChipData(0).Setupdata(27).UnitCnt = 1
  ChipData(0).Setupdata(27).UnitList(0) = "Hz"
  
  ChipData(0).Setupdata(28).Name = "Raise/Lower Response Time"
  ChipData(0).Setupdata(28).ValueDefault = 0#
  ChipData(0).Setupdata(28).Value = ChipData(0).Setupdata(28).ValueDefault
  ChipData(0).Setupdata(28).ValueCnt = 0
  ChipData(0).Setupdata(28).UnitCnt = 1
  ChipData(0).Setupdata(28).UnitList(0) = " "
  
  ChipData(0).Setupdata(29).Name = "Maximum Motor Speed"
  ChipData(0).Setupdata(29).ValueDefault = 0#
  ChipData(0).Setupdata(29).Value = ChipData(0).Setupdata(29).ValueDefault
  ChipData(0).Setupdata(29).ValueCnt = 0
  ChipData(0).Setupdata(29).UnitCnt = 1
  ChipData(0).Setupdata(29).UnitList(0) = "RPM"
  
  ChipData(0).Setupdata(30).Name = "Minimum Motor Speed"
  ChipData(0).Setupdata(30).ValueDefault = 0#
  ChipData(0).Setupdata(30).Value = ChipData(0).Setupdata(30).ValueDefault
  ChipData(0).Setupdata(30).ValueCnt = 0
  ChipData(0).Setupdata(30).UnitCnt = 1
  ChipData(0).Setupdata(30).UnitList(0) = "RPM"
  
  ChipData(0).Setupdata(31).Name = "Not Used"
  ChipData(0).Setupdata(31).ValueDefault = 0#
  ChipData(0).Setupdata(31).Value = ChipData(0).Setupdata(31).ValueDefault
  ChipData(0).Setupdata(31).ValueCnt = 0
  ChipData(0).Setupdata(31).UnitCnt = 1
  ChipData(0).Setupdata(31).UnitList(0) = "(Not Used)"
  
  ChipData(0).Setupdata(32).Name = "Not Used"
  ChipData(0).Setupdata(32).ValueDefault = 0#
  ChipData(0).Setupdata(32).Value = ChipData(0).Setupdata(32).ValueDefault
  ChipData(0).Setupdata(32).ValueCnt = 0
  ChipData(0).Setupdata(32).UnitCnt = 1
  ChipData(0).Setupdata(32).UnitList(0) = "(Not Used)"
  
  ChipData(0).Setupdata(33).Name = "Weight Signal Gain Factor"
  ChipData(0).Setupdata(33).ValueDefault = 0#
  ChipData(0).Setupdata(33).Value = ChipData(0).Setupdata(33).ValueDefault
  ChipData(0).Setupdata(33).ValueCnt = 4
  ChipData(0).Setupdata(33).ValueList(0) = "0 (Normal Gain)"
  ChipData(0).Setupdata(33).ValueList(1) = "1 (High Gain)"
  ChipData(0).Setupdata(33).ValueList(2) = "2 (Normal - Load Cell Amp)"
  ChipData(0).Setupdata(33).ValueList(3) = "3 (High - Load Cell Amp)"
  
  ChipData(0).Setupdata(34).Name = "Not Used"
  ChipData(0).Setupdata(34).ValueDefault = 0#
  ChipData(0).Setupdata(34).Value = ChipData(0).Setupdata(34).ValueDefault
  ChipData(0).Setupdata(34).ValueCnt = 0
  ChipData(0).Setupdata(34).UnitCnt = 1
  ChipData(0).Setupdata(34).UnitList(0) = "(Not Used)"
  
  ChipData(0).Setupdata(35).Name = "Remote Totalizer Pulse Width"
  ChipData(0).Setupdata(35).ValueDefault = 0#
  ChipData(0).Setupdata(35).Value = ChipData(0).Setupdata(35).ValueDefault
  ChipData(0).Setupdata(35).ValueCnt = 0
  ChipData(0).Setupdata(35).UnitCnt = 1
  ChipData(0).Setupdata(35).UnitList(0) = " "
  
  ChipData(0).Setupdata(36).Name = "Test Chain Weight"
  ChipData(0).Setupdata(36).ValueDefault = 0#
  ChipData(0).Setupdata(36).Value = ChipData(0).Setupdata(36).ValueDefault
  ChipData(0).Setupdata(36).ValueCnt = 0
  ChipData(0).Setupdata(36).UnitCnt = 1
  ChipData(0).Setupdata(36).UnitList(0) = " "
  
  '**************************************************
  
  ChipData(1).ChipName = "D32400-230"
  ChipData(1).MaxSetup = 22
  
  ChipData(1).Setupdata(0).Name = "Run Permissive Flag"
  ChipData(1).Setupdata(0).ValueDefault = 0#
  ChipData(1).Setupdata(0).Value = ChipData(1).Setupdata(0).ValueDefault
  ChipData(1).Setupdata(0).ValueCnt = 2
  ChipData(1).Setupdata(0).ValueList(0) = "0 (SS Ignored)"
  ChipData(1).Setupdata(0).ValueList(1) = "1 (Requires SS)"
  
  ChipData(1).Setupdata(1).Name = "Hopper Size"
  ChipData(1).Setupdata(1).ValueDefault = 0#
  ChipData(1).Setupdata(1).Value = ChipData(1).Setupdata(1).ValueDefault
  ChipData(1).Setupdata(1).ValueCnt = 0
  ChipData(1).Setupdata(1).UnitCnt = 1
  ChipData(1).Setupdata(1).UnitList(0) = "Lbs"
  
  ChipData(1).Setupdata(2).Name = "Batch Cycle Time"
  ChipData(1).Setupdata(2).ValueDefault = 0#
  ChipData(1).Setupdata(2).Value = ChipData(1).Setupdata(2).ValueDefault
  ChipData(1).Setupdata(2).ValueCnt = 0
  ChipData(1).Setupdata(2).UnitCnt = 1
  ChipData(1).Setupdata(2).UnitList(0) = "Seconds"
  
  ChipData(1).Setupdata(3).Name = "Calibration Weight"
  ChipData(1).Setupdata(3).ValueDefault = 3#
  ChipData(1).Setupdata(3).Value = ChipData(1).Setupdata(3).ValueDefault
  ChipData(1).Setupdata(3).ValueCnt = 0
  ChipData(1).Setupdata(3).UnitCnt = 1
  ChipData(1).Setupdata(3).UnitList(0) = "Lbs"
  
  ChipData(1).Setupdata(4).Name = "Batch Target Weight"
  ChipData(1).Setupdata(4).ValueDefault = 0#
  ChipData(1).Setupdata(4).Value = ChipData(1).Setupdata(4).ValueDefault
  ChipData(1).Setupdata(4).ValueCnt = 0
  ChipData(1).Setupdata(4).UnitCnt = 1
  ChipData(1).Setupdata(4).UnitList(0) = "Lbs"
  
  ChipData(1).Setupdata(5).Name = "Totalizer Increment"
  ChipData(1).Setupdata(5).ValueDefault = 0#
  ChipData(1).Setupdata(5).Value = ChipData(1).Setupdata(5).ValueDefault
  ChipData(1).Setupdata(5).ValueCnt = 0
  ChipData(1).Setupdata(5).UnitCnt = 1
  ChipData(1).Setupdata(5).UnitList(0) = "Lbs per pulse"
  
  ChipData(1).Setupdata(6).Name = "Load Cell Size"
  ChipData(1).Setupdata(6).ValueDefault = 0#
  ChipData(1).Setupdata(6).Value = ChipData(1).Setupdata(6).ValueDefault
  ChipData(1).Setupdata(6).ValueCnt = 0
  ChipData(1).Setupdata(6).UnitCnt = 1
  ChipData(1).Setupdata(6).UnitList(0) = "Lbs"
  
  ChipData(1).Setupdata(7).Name = "Volume Delivery Weight"
  ChipData(1).Setupdata(7).ValueDefault = 0#
  ChipData(1).Setupdata(7).Value = ChipData(1).Setupdata(7).ValueDefault
  ChipData(1).Setupdata(7).ValueCnt = 0
  ChipData(1).Setupdata(7).UnitCnt = 1
  ChipData(1).Setupdata(7).UnitList(0) = "Cubic Inches/Minute"
  
  ChipData(1).Setupdata(8).Name = "Feedrate Feedback Scaling"
  ChipData(1).Setupdata(8).ValueDefault = 0#
  ChipData(1).Setupdata(8).Value = ChipData(1).Setupdata(8).ValueDefault
  ChipData(1).Setupdata(8).ValueCnt = 0
  ChipData(1).Setupdata(8).UnitCnt = 1
  ChipData(1).Setupdata(8).UnitList(0) = "Lbs/Hour"
  
  ChipData(1).Setupdata(9).Name = "Fill Timeout Error"
  ChipData(1).Setupdata(9).ValueDefault = 0#
  ChipData(1).Setupdata(9).Value = ChipData(1).Setupdata(9).ValueDefault
  ChipData(1).Setupdata(9).ValueCnt = 2
  ChipData(1).Setupdata(9).ValueList(0) = "0 (Trip)"
  ChipData(1).Setupdata(9).ValueList(1) = "1 (Alarm)"
  
  ChipData(1).Setupdata(10).Name = "Communications Unit Number"
  ChipData(1).Setupdata(10).ValueDefault = 0#
  ChipData(1).Setupdata(10).Value = ChipData(1).Setupdata(10).ValueDefault
  ChipData(1).Setupdata(10).ValueCnt = 0
  ChipData(1).Setupdata(10).UnitCnt = 1
  ChipData(1).Setupdata(10).UnitList(0) = " "
  
  ChipData(1).Setupdata(11).Name = "Turns Counter Pulses"
  ChipData(1).Setupdata(11).ValueDefault = 0#
  ChipData(1).Setupdata(11).Value = ChipData(1).Setupdata(11).ValueDefault
  ChipData(1).Setupdata(11).ValueCnt = 0
  ChipData(1).Setupdata(11).UnitCnt = 1
  ChipData(1).Setupdata(11).UnitList(0) = " "
  
  ChipData(1).Setupdata(12).Name = "Material Flow Determination"
  ChipData(1).Setupdata(12).ValueDefault = 0#
  ChipData(1).Setupdata(12).Value = ChipData(1).Setupdata(12).ValueDefault
  ChipData(1).Setupdata(12).ValueCnt = 2
  ChipData(1).Setupdata(12).ValueList(0) = "0 (LSSB Used)"
  ChipData(1).Setupdata(12).ValueList(1) = "1 (No LSSB)"

  ChipData(1).Setupdata(13).Name = "Low Inlet Flow Percentage"
  ChipData(1).Setupdata(13).ValueDefault = 0#
  ChipData(1).Setupdata(13).Value = ChipData(1).Setupdata(13).ValueDefault
  ChipData(1).Setupdata(13).ValueCnt = 0
  ChipData(1).Setupdata(13).UnitCnt = 1
  ChipData(1).Setupdata(13).UnitList(0) = "%"

  ChipData(1).Setupdata(14).Name = "Low Outlet Flow Percentage"
  ChipData(1).Setupdata(14).ValueDefault = 0#
  ChipData(1).Setupdata(14).Value = ChipData(1).Setupdata(14).ValueDefault
  ChipData(1).Setupdata(14).ValueCnt = 0
  ChipData(1).Setupdata(14).UnitCnt = 1
  ChipData(1).Setupdata(14).UnitList(0) = "%"
  
  ChipData(1).Setupdata(15).Name = "Gate Close Delay"
  ChipData(1).Setupdata(15).ValueDefault = 0#
  ChipData(1).Setupdata(15).Value = ChipData(1).Setupdata(15).ValueDefault
  ChipData(1).Setupdata(15).ValueCnt = 0
  ChipData(1).Setupdata(15).UnitCnt = 1
  ChipData(1).Setupdata(15).UnitList(0) = "Seconds"
  
  ChipData(1).Setupdata(16).Name = "Display Units Option"
  ChipData(1).Setupdata(16).ValueDefault = 0#
  ChipData(1).Setupdata(16).Value = ChipData(1).Setupdata(16).ValueDefault
  ChipData(1).Setupdata(16).ValueCnt = 4
  ChipData(1).Setupdata(16).ValueList(0) = "0 (U.S. Tons)"
  ChipData(1).Setupdata(16).ValueList(1) = "1 (Lbs)"
  ChipData(1).Setupdata(16).ValueList(2) = "2 (Metric Tons)"
  ChipData(1).Setupdata(16).ValueList(3) = "3 (Kgs)"
  
  ChipData(1).Setupdata(17).Name = "Batch Alarm Reset"
  ChipData(1).Setupdata(17).ValueDefault = 0#
  ChipData(1).Setupdata(17).Value = ChipData(1).Setupdata(17).ValueDefault
  ChipData(1).Setupdata(17).ValueCnt = 8
  ChipData(1).Setupdata(17).ValueList(1) = "1"
  ChipData(1).Setupdata(17).ValueList(2) = "2 (Use With U.B.C.)"
  ChipData(1).Setupdata(17).ValueList(3) = "3"
  ChipData(1).Setupdata(17).ValueList(4) = "4 (Typical)"
  ChipData(1).Setupdata(17).ValueList(5) = "5"
  ChipData(1).Setupdata(17).ValueList(6) = "6"
  ChipData(1).Setupdata(17).ValueList(7) = "7"
  ChipData(1).Setupdata(17).ValueList(8) = "8"
  
  ChipData(1).Setupdata(18).Name = "Feedback Signal Filter"
  ChipData(1).Setupdata(18).ValueDefault = 0#
  ChipData(1).Setupdata(18).Value = ChipData(1).Setupdata(18).ValueDefault
  ChipData(1).Setupdata(18).ValueCnt = 9
  ChipData(1).Setupdata(18).ValueList(0) = "0 (None)"
  ChipData(1).Setupdata(18).ValueList(1) = "1 (Lowest)"
  ChipData(1).Setupdata(18).ValueList(2) = "2"
  ChipData(1).Setupdata(18).ValueList(3) = "3 (Typical)"
  ChipData(1).Setupdata(18).ValueList(4) = "4"
  ChipData(1).Setupdata(18).ValueList(5) = "5"
  ChipData(1).Setupdata(18).ValueList(6) = "6"
  ChipData(1).Setupdata(18).ValueList(7) = "7"
  ChipData(1).Setupdata(18).ValueList(8) = "8 (Highest)"
  
  ChipData(1).Setupdata(19).Name = "Remote FRI Frequency"
  ChipData(1).Setupdata(19).ValueDefault = 0#
  ChipData(1).Setupdata(19).Value = ChipData(1).Setupdata(19).ValueDefault
  ChipData(1).Setupdata(19).ValueCnt = 0
  ChipData(1).Setupdata(19).UnitCnt = 1
  ChipData(1).Setupdata(19).UnitList(0) = "Hz/TPH"

  ChipData(1).Setupdata(20).Name = "Hopper Gate Closing"
  ChipData(1).Setupdata(20).ValueDefault = 0#
  ChipData(1).Setupdata(20).Value = ChipData(1).Setupdata(20).ValueDefault
  ChipData(1).Setupdata(20).ValueCnt = 2
  ChipData(1).Setupdata(20).ValueList(0) = "0 (Air to Close)"
  ChipData(1).Setupdata(20).ValueList(1) = "1 (Counterweight)"
  
  ChipData(1).Setupdata(21).Name = "Fill Timeout Duration"
  ChipData(1).Setupdata(21).ValueDefault = 0#
  ChipData(1).Setupdata(21).Value = ChipData(1).Setupdata(21).ValueDefault
  ChipData(1).Setupdata(21).ValueCnt = 0
  ChipData(1).Setupdata(21).UnitCnt = 1
  ChipData(1).Setupdata(21).UnitList(0) = "Seconds"

  ChipData(1).Setupdata(22).Name = "Premature Gate Open Error"
  ChipData(1).Setupdata(22).ValueDefault = 0#
  ChipData(1).Setupdata(22).Value = ChipData(1).Setupdata(22).ValueDefault
  ChipData(1).Setupdata(22).ValueCnt = 2
  ChipData(1).Setupdata(22).UnitList(0) = "0 (Trip)"
  ChipData(1).Setupdata(22).UnitList(1) = "1 (Alarm)"

  '**************************************************

     
End Sub


Finally, here is the source code for my data structures:

Code:
Option Explicit

  Public Type SetupDataType
    Name            As String
    Value           As Double
    ValueCnt        As Long
    ValueList(32)   As String
    ValueDefault    As Double
    Unit            As String
    UnitCnt         As Long
    UnitList(32)    As String
  End Type

  Public Type ChipDataType
    ChipName        As String
    MaxSetup        As Long
    Setupdata(64)   As SetupDataType
  End Type

  Global ChipData(64)       As ChipDataType
  Global MaxChipNo          As Long

  Global sText              As String

  Global CurrentChipNo      As Long
  Global CurrentSetup       As Long


I omitted the excess chip information, as per your suggestion.

It seems to be working now though! I changed a few things (the code above reflects these changes), but I have run into another problem you may be able to help me with. Now I have these forms and if the user cycles to another chip, the data is not saved - it is reset to its default value. Also, if the user uses the arrows to go to the next parameter then goes back, the data is defaulted. Do you know how I can keep this from happening and how to save the form to a neat, formatted .txt file? Thanks again. :)
 
Ok, that looks pretty solid. A couple of observations:

1. Don't use the Form_Initialize event for this type of thing, use Form_Load.
2. Naming conventions for forms and other controls are:
a. Forms begin with frm
b. ListBoxes begin with lst
c. ComboBoxes begin with cbo
d. Command buttons begin with cmd
So, for example, consider changing "ChipNoBox" to "cboChipNo".

<Do you know how I can keep this from happening
Sure. Here's where your values are being stored, as an example:
Code:
ChipData(0).Setupdata(0).Value = ChipData(0).Setupdata(0).ValueDefault
You'll perhaps notice that in no place in your code do you set this value again. So, it stays as the default.

So, create another proc called CaptureScreen, that stores any user-supplied values to the appropriate variables. Call that in the appropriate click event before you call FillScreen.

Bob
 
Bob,

Thanks again for your help with this. I think I see what you are saying with the ValueDefault kicking in. However, I don't know what CaptureScreen should be. Should it be within the data structure? Also, when you say that I should map it to the appropriate click event, do you mean the back and forth arrows that I have?

If it's not too much to ask, could you give me an example of how a proc called CaptureScreen would work? Thank you.
 
Oh, sorry. Analogous to FillScreen. Create a sub called CaptureScreen or whatever, and call it when you need to update your variables with the user's input.
 
Oh, sorry. Analogous to FillScreen. Create a sub called CaptureScreen or whatever, and call it when you need to update your variables with the user's input. Kind of the reverse of what you're doing with FillScreen, which is populate your screen with your variables.

So, anywhere the user could enter data, find what he entered, and update your variables appropriately.

Feel free to ask more specific questions if you need more help.

Bob

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top