|
-
Aug 3rd, 2009, 12:10 PM
#1
Thread Starter
New Member
displaying results from notepad into picture box with vb6
Code:
intEndVolt = 10
For intIndex = 0 To 9
For intVolt = 1 To intEndVolt
intResist = Val(cboResist(intIndex).Text)
intlstResistor = Val(lstResistor(intIndex).Text)
If cboResist(intIndex).Visible = True And lstResistor(intIndex).Visible = True Then
'Power dissipated by each Resistor in Series
intCurrent = (intResist * intlstResistor / 1) * intVolt
intPower_Series = ((intCurrent ^ 2) * (intResist * intlstResistor))
'Power dissipated by each Resistor in Parallel
intPower_Parallel = (intVolt * intVolt) / (intResist * intlstResistor)
'Current Through each Parallel Resistor
intCurrent_Parallel = ((intResist * intlstResistor) / 1) * intVolt
'Voltage Across each Series Resistor
intTotalResistor = (intResist * intlstResistor) + (intResist * intlstResistor)
intVoltage_Series = (intTotalResistor / intVolt) * (intResist * intlstResistor)
'Writing the data above to disk
Write #1, intPower_Series, intPower_Parallel, intCurrent_Parallel, intVoltage_Series
End If
Do While Not EOF(1)
Input #2, intPower_Series
Loop
picResult.Print intPower_Series
Next intVolt
Next intIndex
Close #1
Close #2
The above coding is what i've done so far. What it is does is some, not all, of the following, which is the task given to me:
--------------------
on automatically changing the input voltage from 1 to 10 volts in steps of 1 volt the following will be written
to disk:-
1. The power dissipated by each resistor in series
2. The power dissipated by each resistor in parallel
3. The current through each parallel resistor
4. The voltage across each series resistor
The program should allow for the following:-
For a user defined input voltage the following data should be downloaded from disk:-
• the power dissipated by each resistor in series
• the power dissipated by each resistor in parallel
• the voltage across each series resistor
• the current through each parallel resistor
The downloaded data should then be plotted as a series of bar charts.
--------------------
The part in bold is the problem for me. Now, the part in red of my coding reads 'the power dissipated by each resistor in series' for resistors chosen from notepad and then displays all the results from 1 to 10 volts in, for now, a picture box. But what I really want is to only display the result that is calculated with the voltage I first select and with nothing else. What I mean by that is when the user first selects a voltage automatically, as said above in the task, the calculation 'the resistors chosen' * 'all ten volts' from steps of 1 volt are sent into notepad. But I don't want all to be read from notepad into the picture box but just the first selected volt that was chosen. For example, lets say two resistors, as shown below, is displayed for the 'power dissipated by each resistor in series' from volts 1 to 10 in notepad.
R1 * Volt = X
Volt R1 R2
1 X x
2 X x
3 X x
4 X x
5 X x
6 X x
7 X x
8 X x
9 X x
10 X x
I don't want all to be read of the 'power dissipated...' from volts 1 to 10 but just the one first orginally selected, eg the one in bold, to be displayed in the pic box.
sorry if i kept on repeating things, just trying to make everything sound understandable.
thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|