Click here to Skip to main content
15,899,474 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionRefresh font folder [modified] Pin
hitesh sojitra14-Sep-08 19:17
hitesh sojitra14-Sep-08 19:17 
AnswerRe: Refresh font folder Pin
Ajay.k_Singh15-Sep-08 0:01
Ajay.k_Singh15-Sep-08 0:01 
QuestionAutoCompleteStringCollection Pin
CodingYoshi14-Sep-08 18:44
CodingYoshi14-Sep-08 18:44 
AnswerRe: AutoCompleteStringCollection Pin
Ashfield14-Sep-08 21:05
Ashfield14-Sep-08 21:05 
GeneralRe: AutoCompleteStringCollection Pin
CodingYoshi15-Sep-08 3:26
CodingYoshi15-Sep-08 3:26 
AnswerAutoCompleteStringCollection Pin
AshimD6-Dec-08 3:34
AshimD6-Dec-08 3:34 
QuestionVS 2005 resources Pin
Rafone14-Sep-08 8:38
Rafone14-Sep-08 8:38 
QuestionMaking a function or a sub Pin
Maffyx14-Sep-08 7:34
Maffyx14-Sep-08 7:34 
Ok I had a post earlier about finding a string in a file and all that, well I got that code working, but I have a new problem. I want to put it all into a function or a sub. I'm not sure what the difference is but I want it to have an input, use the code, and then return what the code says. Is something like this possible? Here is the code I am using:

The input is startval and the output is roundednum

I have a listbox full of options, and there are cases under if it is selected, it would input a string to be searched and then a number would be returned.

Dim fs As New FileStream("C:\Program Files\World of Warcraft\WTF\Account\<accountname>\SavedVariables\Auc-Stat-Simple.lua", FileMode.Open)
        Dim sr As New StreamReader(fs)
        Dim intcounter As Integer
        Dim line As String = ""
        Dim count As Integer
        Dim LineOfText As String
        Dim i As Integer
        Dim aryTextFile() As String
        Dim startval As String
        Dim chArr() As Char = {"""", ","}
        Dim roundednum As Double

        
        startval = ""

        Try

            Do
                line = sr.ReadLine()
                If line IsNot Nothing Then
                    If line.Contains(startval) Then
                        intcounter = intcounter + 1
                        If intcounter = 1 Then
                            LineOfText = line
                            aryTextFile = LineOfText.Split(";".ToCharArray)
                            For i = 0 To UBound(aryTextFile)
                                count = count + 1
                                If count = 6 Then
                                    roundednum = aryTextFile(i).Trim(chArr)
                                    If roundednum.ToString.Length = 5 Then
                                        roundednum = roundednum * 0.01
                                        roundednum = Math.Round(roundednum, 0)
                                    Else
                                        roundednum = roundednum * 0.0001
                                        roundednum = Math.Round(roundednum, 0)
                                    End If
                                    'Label11.Text = (aryTextFile(i).Trim(chArr))
                                    Label11.Text = (roundednum)'as a test
                                    count = 0
                                End If
                            Next i
                            'Label11.Text = line
                        End If
                    End If
                End If
            Loop While line IsNot Nothing
        Catch a As Exception
            Label11.Text = "Not Found"
        End Try

        sr.Close()</accountname>

AnswerRe: Making a function or a sub Pin
Scott Dorman14-Sep-08 7:47
professionalScott Dorman14-Sep-08 7:47 
GeneralRe: Making a function or a sub Pin
Maffyx14-Sep-08 8:16
Maffyx14-Sep-08 8:16 
GeneralRe: Making a function or a sub Pin
Scott Dorman14-Sep-08 8:23
professionalScott Dorman14-Sep-08 8:23 
QuestionGet # of items in recycle bin Pin
jacobjordan13-Sep-08 12:28
jacobjordan13-Sep-08 12:28 
AnswerRe: Get # of items in recycle bin Pin
jzonthemtn13-Sep-08 14:58
jzonthemtn13-Sep-08 14:58 
GeneralRe: Get # of items in recycle bin Pin
jacobjordan13-Sep-08 16:24
jacobjordan13-Sep-08 16:24 
QuestionXML generating problem Pin
pbbhatt12-Sep-08 20:17
pbbhatt12-Sep-08 20:17 
AnswerRe: XML generating problem Pin
Dave Kreskowiak13-Sep-08 5:04
mveDave Kreskowiak13-Sep-08 5:04 
AnswerRe: XML generating problem Pin
Ashfield14-Sep-08 21:07
Ashfield14-Sep-08 21:07 
QuestionPrograaming in Visual Basic.Net Pin
dereck12-Sep-08 19:41
dereck12-Sep-08 19:41 
AnswerRe: Prograaming in Visual Basic.Net Pin
Garth J Lancaster12-Sep-08 19:53
professionalGarth J Lancaster12-Sep-08 19:53 
JokeRe: Prograaming in Visual Basic.Net Pin
Paul Conrad13-Sep-08 5:06
professionalPaul Conrad13-Sep-08 5:06 
GeneralRe: Prograaming in Visual Basic.Net Pin
Garth J Lancaster13-Sep-08 5:22
professionalGarth J Lancaster13-Sep-08 5:22 
GeneralRe: Prograaming in Visual Basic.Net Pin
Paul Conrad13-Sep-08 5:25
professionalPaul Conrad13-Sep-08 5:25 
GeneralGO GARTH! GO GARTH! Pin
leckey13-Sep-08 15:35
leckey13-Sep-08 15:35 
GeneralRe: GO GARTH! GO GARTH! Pin
Garth J Lancaster13-Sep-08 18:04
professionalGarth J Lancaster13-Sep-08 18:04 
AnswerRe: Prograaming in Visual Basic.Net Pin
Dave Kreskowiak13-Sep-08 5:22
mveDave Kreskowiak13-Sep-08 5:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.