Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 149,536 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,517 people online right now. Registration is fast and FREE... Join Now!




Help with this VB Problem needed asap!

 
Reply to this topicStart new topic

Help with this VB Problem needed asap!

abarnett
26 Nov, 2007 - 06:41 AM
Post #1

New D.I.C Head
*

Joined: 25 Oct, 2007
Posts: 22


My Contributions
Alright here's the problem:

3. Fahrenheit to Centigrade calculation. Your F should start at 98 and go to 106, by an increment of .1. You will only have two columns, F and C

and our requirements:

Requirements for all programs
Each program will use a function to do the calculation (at least one calculation per program)
Each program will display the data in a list view control
Each program will print the data to an html file (copy and past the code to reuse it over and over)
Send me the executable
The program should ask for the name of the html file. Use an input box. Use concatenation to make the open string. When I run the exe, it will ask for the name of the file and I will enter something like “c:\test.html”. I can then open c:\test.html in Internet Explorer.


here's my code so far: (I'm probably wayyy off)

CODE

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        strUserInput = InputBox("Enter HTML file name", "Input Needed")
    End Sub

    Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
        lvTemp.Items.Clear()
        Dim temp As Double
        temp = getTemp()


    End Sub
    Function getTemp()


        Dim f As Double
        Dim c As Double
        lvTemp.Items.Clear()
        FileOpen(1, "b:\tempconversion.htm", OpenMode.Output)

        Print(1, "<html><head><title>Temp Table</title></head><body>")
        Print(1, "<table width =400 border = 1>") 'define table in html file
        Print(1, "<thead>")
        Print(1, "<th width = 400 >Fahrenheit</th>")
        Print(1, "<th width = 400 >Centigrade</th>")
        Print(1, "</thead>")

        For f = 98 To 106 Step 0.1
            c = (f - 32) * 5 / 9

        Next
        Print(1, "<tr><td align = center >")
        Print(1, f)
        Print(1, "</td>")

        Print(1, "<td align = center>")
        Print(1, c)
        Print(1, "</td>")
        Print(1, "</tr>") 'end of table row
        FileClose(1)


        Return 0

    End Function
End Class


Any Help would be appreciated!! My calculate button is not working. The program runs but it's not printing anything out in the lv. I don't know??
User is offlineProfile CardPM
+Quote Post

Domeman165
RE: Help With This VB Problem Needed Asap!
26 Nov, 2007 - 11:41 AM
Post #2

New D.I.C Head
*

Joined: 13 Nov, 2007
Posts: 7


My Contributions
Here is some code to fill a listview contol. The list view requires a Listitem object to hold the values for the listview. Hope this helps.

CODE

    Dim clmX As ColumnHeader
  
    Dim f    As Single
    Dim c    As Single
  
    ' Add ColumnHeaders. The width of the columns is the width
    ' of the control divided by the number of ColumnHeader objects.
    Set clmX = ListView1.ColumnHeaders.Add(, , "F", ListView1.Width / 2)
    Set clmX = ListView1.ColumnHeaders.Add(, , "C", ListView1.Width / 2)
  
    ListView1.BorderStyle = ccFixedSingle   ' Set BorderStyle property.
    ListView1.View = lvwReport              ' Set View property to Report.
    
    ' Create a variable to add ListItem objects.
    Dim itmX As ListItem

    For f = 98 To 106 Step 0.1
        c = (f - 32) * 5 / 9

        Set itmX = ListView1.ListItems.Add(, , Format(f, "##0.00"))
        itmX.SubItems(1) = Format(c, "##0.000")
    Next



User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 09:11PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month