Click here to Skip to main content
15,896,063 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Do I need an adapter/connection to run an SQL statement? Pin
penguin500019-Mar-07 6:02
penguin500019-Mar-07 6:02 
GeneralRe: Do I need an adapter/connection to run an SQL statement? Pin
Christian Graus19-Mar-07 7:09
protectorChristian Graus19-Mar-07 7:09 
QuestionHelp with StreamReader Pin
Brad^19-Mar-07 3:48
Brad^19-Mar-07 3:48 
AnswerRe: Help with StreamReader [modified] Pin
JUNEYT19-Mar-07 5:16
JUNEYT19-Mar-07 5:16 
GeneralRe: Help with StreamReader Pin
Brad^19-Mar-07 5:34
Brad^19-Mar-07 5:34 
GeneralRe: Help with StreamReader Pin
JUNEYT19-Mar-07 5:53
JUNEYT19-Mar-07 5:53 
GeneralRe: Help with StreamReader Pin
Brad^19-Mar-07 6:52
Brad^19-Mar-07 6:52 
GeneralRe: Help with StreamReader [modified] Pin
Brad^20-Mar-07 14:31
Brad^20-Mar-07 14:31 
JUNETY or anyone else, i have just had to format my pc and when i load up VS05 and my code i keep getting this error when debuging it, i have looked everywhere but it is really baffling me! any help will be appreciated!

Dim username1 As New IO.StreamReader("C:\username.txt")<br />
    Dim password1 As New IO.StreamReader("C:\password.txt")<br />
    Dim adminun As New IO.StreamReader("C:\adminun.txt")<br />
    Dim adminpw As New IO.StreamReader("C:\adminpw.txt")<br />
<br />
<br />
Private Sub Login_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Login.Click<br />
        Do While username1.EndOfStream<br />
            If username1.ReadLine() = Username.Text.ToString & Password.Text.ToString Then<br />
                Exit Do<br />
            End If<br />
        Loop<br />
        username1.Close()<br />
        Do While password1.EndOfStream<br />
            If username1.ReadLine() = Username.Text.ToString & Password.Text.ToString Then<br />
                Exit Do<br />
            End If<br />
        Loop<br />
        password1.Close()<br />
    End Sub<br />


ERROR:
System.ObjectDisposedException was unhandled<br />
  Message="Cannot read from a closed TextReader."<br />
  ObjectName=""<br />
  Source="mscorlib"<br />
  StackTrace:<br />
       at System.IO.__Error.ReaderClosed()<br />
       at System.IO.StreamReader.get_EndOfStream()<br />
       at WindowsApplication1.Form1.Login_Click(Object sender, EventArgs e) in C:\Users\Brad\Documents\Visual Studio 2005\Projects\SC Login\SC Login\Form1.vb:line 9<br />
       at System.Windows.Forms.Control.OnClick(EventArgs e)<br />
       at System.Windows.Forms.Button.OnClick(EventArgs e)<br />
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)<br />
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)<br />
       at System.Windows.Forms.Control.WndProc(Message& m)<br />
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)<br />
       at System.Windows.Forms.Button.WndProc(Message& m)<br />
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)<br />
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)<br />
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)<br />
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)<br />
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)<br />
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)<br />
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)<br />
       at System.Windows.Forms.Application.Run(ApplicationContext context)<br />
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()<br />
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()<br />
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)<br />
       at WindowsApplication1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81<br />
       at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)<br />
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)<br />
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()<br />
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)<br />
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)<br />
       at System.Threading.ThreadHelper.ThreadStart()


I am on Vista but still cannot see why it is thwoing this exception, I have tried putting the files on desktop etc but still getting "Cannot read from a closed TextReader". Also another problem is that when i click "login" once nothing happens even with other code but when i double click i get the above error!

Thanks


-- modified at 20:36 Tuesday 20th March, 2007
GeneralRe: Help with StreamReader Pin
JUNEYT20-Mar-07 22:12
JUNEYT20-Mar-07 22:12 
QuestionHow to retrieve a value from application config file? [modified] Pin
JUNEYT19-Mar-07 3:17
JUNEYT19-Mar-07 3:17 
AnswerRe: How to retrieve a value from application config file? Pin
coolestCoder20-Mar-07 1:21
coolestCoder20-Mar-07 1:21 
GeneralRe: How to retrieve a value from application config file? Pin
JUNEYT20-Mar-07 2:10
JUNEYT20-Mar-07 2:10 
AnswerRe: How to retrieve a value from application config file? Pin
JenisysJohn11-Apr-07 8:14
JenisysJohn11-Apr-07 8:14 
GeneralRe: How to retrieve a value from application config file? Pin
JenisysJohn11-Apr-07 8:15
JenisysJohn11-Apr-07 8:15 
QuestionRetrieving information (urls, ...) about temporary internet files Pin
haleemha19-Mar-07 0:55
haleemha19-Mar-07 0:55 
QuestionChange color at run time Pin
nawalage18-Mar-07 23:07
nawalage18-Mar-07 23:07 
AnswerRe: Change color at run time Pin
Kschuler19-Mar-07 9:21
Kschuler19-Mar-07 9:21 
QuestionRe: Change color at run time Pin
nawalage19-Mar-07 21:36
nawalage19-Mar-07 21:36 
QuestionHow to convert existing C# Windows Application to C# Web Application.. Pin
MPS_DotNet18-Mar-07 21:10
MPS_DotNet18-Mar-07 21:10 
AnswerRe: How to convert existing C# Windows Application to C# Web Application.. Pin
Colin Angus Mackay19-Mar-07 0:52
Colin Angus Mackay19-Mar-07 0:52 
AnswerRe: How to convert existing C# Windows Application to C# Web Application.. Pin
Dave Kreskowiak19-Mar-07 1:40
mveDave Kreskowiak19-Mar-07 1:40 
Questionconvert to excel format Pin
Amit Sk Sharma18-Mar-07 19:09
Amit Sk Sharma18-Mar-07 19:09 
AnswerRe: convert to excel format Pin
Tirthadip18-Mar-07 19:44
Tirthadip18-Mar-07 19:44 
QuestionClose the word document by using controlbox Pin
Nanda160518-Mar-07 19:07
Nanda160518-Mar-07 19:07 
QuestionI need some advice from experts about integrating activation code implementation. Pin
JUNEYT18-Mar-07 11:19
JUNEYT18-Mar-07 11: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.