Visual Basic

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized ForumsDesktop ProgrammingVisual Basic

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old November 14th, 2009, 06:44 AM
omegared1234 omegared1234 is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Nov 2009
Posts: 1 omegared1234 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 41 m 42 sec
Reputation Power: 0
Arrow Vb random text to textbox HELP

Hi there,

I need your help in getting each and every line to display in textbox1. The line has a random line generated from an external text file. Can you help me?
I bold the area I am having trouble with.

Imports System.IO
Public Class Form1
Dim InputStream As FileStream
Dim Reader As StreamReader
Dim Input As String
Dim ReadLine As String
Dim Buffer As Array
Dim fileStream As System.IO.StreamReader = New System.IO.StreamReader("c:\murphy.txt")
Dim LineCounter As Integer

Public Sub Readfile()
InputStream = New FileStream("c:\murphy.txt", FileMode.Open, FileAccess.Read)
Reader = New StreamReader(InputStream, False)
Dim myTextLines() As String = IO.File.ReadAllLines("c:\murphy.txt")
Dim myRandom As New Random
Dim mySequence = Enumerable.Range(0, myTextLines.Length).OrderBy(Function() myRandom.Next)
For Each i As Integer In mySequence
TextBox1.Text = myTextLines(i)\
Next
Reader.Close()
InputStream.Close()

End Sub

Private Sub Counter()
LineCounter = LineCounter + 1
Label1.Text = LineCounter
If LineCounter = 10 Then
MessageBox.Show("done")
LineCounter = 0
TextBox1.Clear()

End If

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Readfile()
Counter()
End Sub

End Class

Reply With Quote
Reply

Viewing: Tutorialized ForumsDesktop ProgrammingVisual Basic > Vb random text to textbox HELP


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap