code not printing

my code is not printing in the listbox

Page 1 of 1

9 Replies - 836 Views - Last Post: 06 November 2008 - 11:26 AM Rate Topic: -----

#1 kschmidt  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 22
  • Joined: 17-October 08

code not printing

Post icon  Posted 04 November 2008 - 11:08 AM

I need to make a code that just simple loops and prints on the input.you will put the speed your going and than the time .
Vehicle speed 40 MPH
Time Traveled 3 hours
prints the total hours
Hours Distance traveled.but nothing is workingd. does anybody have an idea?

        Dim TravelTime As Integer
        Dim VehicleSpeed As Integer
        Dim Miles As Integer

        VehicleSpeed = InputBox("Enter Speed:", "Enter Speed", "55")
        TravelTime = InputBox("Enter Time Traveled:")
        Miles = VehicleSpeed * TravelTime


        Print("Vehicle Speed: " & VehicleSpeed & " MPH")
        Print("Time Traveled: " & TravelTime & " hours")
        Print("Hour  Distance Traveled")
        Print("-------------------------------------")

        For i = 1 To TravelTime

            Print(" " & i & " " & i * VehicleSpeed)

        Next i

        Print("Total Distance: " & Miles)



Mod Edit: Please use code tags when posting your code. Code tags are used like so => :code:

Thanks,
PsychoCoder :)

Is This A Good Question/Topic? 0
  • +

Replies To: code not printing

#2 brds  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 76
  • View blog
  • Posts: 515
  • Joined: 22-October 08

Re: code not printing

Posted 04 November 2008 - 02:40 PM

If you want to output to a list box try listboxname.additem("Some TXT") instead of Print("Some TXT");
Was This Post Helpful? 0
  • +
  • -

#3 kschmidt  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 22
  • Joined: 17-October 08

Re: code not printing

Posted 05 November 2008 - 10:33 AM

View Postbrds, on 4 Nov, 2008 - 01:40 PM, said:

If you want to output to a list box try listboxname.additem("Some TXT") instead of Print("Some TXT");




I changed code but still not printing??
Was This Post Helpful? 0
  • +
  • -

#4 thava  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 172
  • View blog
  • Posts: 1,560
  • Joined: 17-April 07

Re: code not printing

Posted 05 November 2008 - 10:42 PM

in which language vb or vb.net if vb then brds is right
Was This Post Helpful? 0
  • +
  • -

#5 kschmidt  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 22
  • Joined: 17-October 08

Re: code not printing

Posted 06 November 2008 - 06:24 AM

View Postthava, on 5 Nov, 2008 - 09:42 PM, said:

in which language vb or vb.net if vb then brds is right


Hi,
Like I said I am new to Visual Basic I dont know what brds is
please lat me know thanks
Was This Post Helpful? 0
  • +
  • -

#6 thava  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 172
  • View blog
  • Posts: 1,560
  • Joined: 17-April 07

Re: code not printing

Posted 06 November 2008 - 07:21 AM

what is the name of the listbox ?,use that

ok
let us consider the listbox name is samplelist

then add the coding like this instead of print use samplelist.additem

   
samplelist.additem ("Vehicle Speed: " & VehicleSpeed & " MPH")  
samplelist.additem ("Time Traveled: " & TravelTime & " hours")  
samplelist.additem ("Hour  Distance Traveled")  
samplelist.additem ("-------------------------------------")  
   
 For i = 1 To TravelTime  
   
     samplelist.additem (" " & i & " " & i * VehicleSpeed)  
   
 Next i  
   
samplelist.additem ("Total Distance: " & Miles)  


This post has been edited by thava: 06 November 2008 - 07:22 AM

Was This Post Helpful? 0
  • +
  • -

#7 kschmidt  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 22
  • Joined: 17-October 08

Re: code not printing

Posted 06 November 2008 - 08:46 AM

I changed my code but it is still not working . List ist not declared?

 Dim TravelTime As Integer
        Dim VehicleSpeed As Integer
        Dim Hours As Integer
        Dim miles As Integer


        VehicleSpeed = InputBox("Enter Speed:")
        TravelTime = InputBox("Enter Time Traveled:")
        Hours = VehicleSpeed * TravelTime
        

        
        List.additem("Vehicle Speed: " & VehicleSpeed & " MPH")
        List.additem("Time Traveled: " & TravelTime & " hours")
        List.additem("Hour  Distance Traveled")
        List.additem("-------------------------------------")

        For i = 1 To TravelTime

            List.additem(" " & i & " " & i * VehicleSpeed)

        Next i

        List.additem("Total Distance: " & miles)


Was This Post Helpful? 0
  • +
  • -

#8 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1619
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: code not printing

Posted 06 November 2008 - 09:04 AM

What is the name of your ListBox, this is saying that the name you provided isn't declared, meaning you have the name incorrect
Was This Post Helpful? 0
  • +
  • -

#9 kschmidt  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 22
  • Joined: 17-October 08

Re: code not printing

Posted 06 November 2008 - 10:44 AM

View PostPsychoCoder, on 6 Nov, 2008 - 08:04 AM, said:

What is the name of your ListBox, this is saying that the name you provided isn't declared, meaning you have the name incorrect



Thanks everybody I got it
Was This Post Helpful? 0
  • +
  • -

#10 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1619
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: code not printing

Posted 06 November 2008 - 11:26 AM

Glad we could walk you down the path to your solution (though thava was more helpful) :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1