Click here to Skip to main content
16,014,591 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionVBScript - View Source Pin
Reelix11-Sep-08 3:55
Reelix11-Sep-08 3:55 
AnswerRe: VBScript - View Source Pin
jzonthemtn11-Sep-08 6:24
jzonthemtn11-Sep-08 6:24 
GeneralRe: VBScript - View Source Pin
Reelix11-Sep-08 20:11
Reelix11-Sep-08 20:11 
QuestionVB.net Searching File for string Pin
Maffyx11-Sep-08 3:29
Maffyx11-Sep-08 3:29 
AnswerRe: VB.net Searching File for string Pin
jzonthemtn11-Sep-08 6:28
jzonthemtn11-Sep-08 6:28 
GeneralRe: VB.net Searching File for string Pin
Maffyx11-Sep-08 10:31
Maffyx11-Sep-08 10:31 
GeneralRe: VB.net Searching File for string Pin
Maffyx13-Sep-08 18:58
Maffyx13-Sep-08 18:58 
GeneralRe: VB.net Searching File for string Pin
Maffyx13-Sep-08 20:05
Maffyx13-Sep-08 20:05 
Never mind this, I actually figured it out on my own. My last step is to round the last number and format it. I think this would of a different topic from my original question. I have this code and I need to round the number in the array of a string which I don't know if it is possible.


Dim aryTextFile() As String

This is the item I need to round, but it is in array form I believe, and needs to be converted to a decimal to be rounded. I'm not sure how this would be done. I tried making an integer and then assigning the array item to the integer and rounding from there before putting it in the label but this did not work.

What this code does is:
1. Opens the file
2. Reads it line by line till it gets to "[2449] = ""0:"
3. Reads the line that is after "[2449] = ""0:" to get "[2449] = "0:37;5277;1201.7;1297.2;1436.9;467.4","
4. After it gets that string it splits it up 6 times.
5. After the 6th split it gets this string 467.4",
6. It trim the ", off and leaves me with 467.4
7. After 467.4 I need it to be rounded to 467
8. After it is rounded to 467 I need it to be formatted into a certain in game currency. The format goes 100 copper = 1 silver, 100 silver = 1 gold. The number above would be formatted as 4s 67c so its somewhat reversed. Maybe this can be done with simple math.

So far I only need steps 7 and 8

I also want to know if it is in anyway possible to put this code into a function and have data input and returned from it. The information that is in there is hard coded and I don't want to do this for every instance as it would get confusing. I only have it hard coded to test it.


Dim fs As New FileStream("C:\Program Files\World of Warcraft\WTF\Account\<account name="">\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 = {"""", ","}


      startval = "[2449] = ""0:"
      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


                                  Label11.Text = (aryTextFile(i).Trim(chArr))
                                  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()</account>

GeneralRe: VB.net Searching File for string Pin
Maffyx13-Sep-08 20:42
Maffyx13-Sep-08 20:42 
QuestionVBA Quicky Pin
harveyhanson11-Sep-08 0:51
harveyhanson11-Sep-08 0:51 
AnswerRe: VBA Quicky Pin
ChandraRam11-Sep-08 1:20
ChandraRam11-Sep-08 1:20 
QuestionInternet Explorer Toolbar Pin
Gagan.2011-Sep-08 0:38
Gagan.2011-Sep-08 0:38 
AnswerRe: Internet Explorer Toolbar Pin
harveyhanson11-Sep-08 0:52
harveyhanson11-Sep-08 0:52 
GeneralRe: Internet Explorer Toolbar Pin
Gagan.2011-Sep-08 18:13
Gagan.2011-Sep-08 18:13 
AnswerRe: Internet Explorer Toolbar Pin
LloydA11112-Sep-08 12:41
LloydA11112-Sep-08 12:41 
QuestionRe: Internet Explorer Toolbar Pin
Gagan.2012-Sep-08 17:03
Gagan.2012-Sep-08 17:03 
QuestionWindows Services Pin
Gagan.2011-Sep-08 0:32
Gagan.2011-Sep-08 0:32 
AnswerRe: Windows Services Pin
jzonthemtn11-Sep-08 1:28
jzonthemtn11-Sep-08 1:28 
QuestionRe: Windows Services Pin
Gagan.2011-Sep-08 18:21
Gagan.2011-Sep-08 18:21 
AnswerRe: Windows Services Pin
jzonthemtn12-Sep-08 2:18
jzonthemtn12-Sep-08 2:18 
AnswerRe: Windows Services Pin
LloydA11112-Sep-08 12:50
LloydA11112-Sep-08 12:50 
QuestionRe: Windows Services Pin
Gagan.2012-Sep-08 17:10
Gagan.2012-Sep-08 17:10 
QuestionStore MS Word file in SQL Database by vb.net Pin
naresh150710-Sep-08 22:55
naresh150710-Sep-08 22:55 
AnswerRe: Store MS Word file in SQL Database by vb.net Pin
jzonthemtn11-Sep-08 1:31
jzonthemtn11-Sep-08 1:31 
GeneralRe: Store MS Word file in SQL Database by vb.net Pin
naresh150711-Sep-08 18:19
naresh150711-Sep-08 18:19 

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.