Results 1 to 6 of 6

Thread: displaying results from notepad into picture box with vb6

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2009
    Posts
    8

    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

  2. #2

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2009
    Posts
    8

    Re: displaying results from notepad into picture box with vb6

    sorry about that, i just read it myself and I couldnt understand a thing i said, lol.



    Anyway, using sequential files, I want to know how to read and download data from notepad to be plotted onto a bar chart.

    Firstly, when a voltage (from 1 to 10) is first selected the chosen resistors automatically is calculated with each voltage and the answer is displayed in notepad. I have done this part. However, the second part is just as the voltage has been selected, after the data has already been sent to notepad, the program should find in notepad the resistors chosen multiplied by the original voltage first selected and plot the answer for each resistor with the first Voltage selected onto a bar chart.

    thanks

  4. #4

    Thread Starter
    New Member
    Join Date
    Jul 2009
    Posts
    8

    Re: displaying results from notepad into picture box with vb6

    bump

  5. #5

    Thread Starter
    New Member
    Join Date
    Jul 2009
    Posts
    8

    Re: displaying results from notepad into picture box with vb6

    erm, someone must know.

  6. #6
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: displaying results from notepad into picture box with vb6

    Quote Originally Posted by KaliNarsingh View Post
    erm, someone must know.
    I know squat about the MSChart control but maybe this link will help you.

    http://www.vbforums.com/showthread.p...hlight=MSChart

    Sorry I couldn't help more.
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width