vb6 to vb .net showdialog() exception

Hi.. IM working on a migration from VB6 to .Net.
I got the next function (code below) where I get the parameters from Database for the current station. After executing the select I get Y's, enter the if as a true an after executing the showdialog to try to display the Login screen, I get the next error:

ex.tostring "System.ArgumentException: Stream was not readable.
at System.IO.StreamReader..ctor(Stream stream, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize)
at System.IO.StreamReader..ctor(Stream stream)
at AmesComm.TextIO.GetParameter(String parParameterName, String& parRetCode, String& parRetMsg) in C:\Documents and Settings\oupe226\Desktop\Copy of AmesComm\TextIO.vb:line 177
at VB02_WI_II.VB99_Login.VB99_Login_Load(Object eventSender, EventArgs eventArgs) in C:\Documents and Settings\oupe226\Desktop\Copy of VB02_WI_II.NET2 - 16 enero 2005\VB99_Login.vb:line 365
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at System.Windows.Forms.Form.ShowDialog()
at VB02_WI_II.VB99_Procedures.ChkLogIn(String& sStationNumberPar) in C:\Documents and Settings\oupe226\Desktop\Copy of VB02_WI_II.NET2 - 16 enero 2005\VB99_Procedures.vb:line 1256" String

I tried just only showing the form and even declaring a new form inside the cycle and showing it but cant seem to get it working. Could you please help me
Thanks


Public Function ChkLogIn(ByRef sStationNumberPar As String) As String
Dim sAuto As String
Dim sManual As String

'Show form login
sPar_StationNumber = sStationNumberPar
sPar_UserId = ""

GetstationPrams(sPar_StationNumber)
If UCase(sAuto) <> "N" And UCase(sManual) <> "N" Then
VB99_Login.DefInstance.ShowDialog()
Else
sPar_UserId = VB99_OCX.DefInstance.DB.Pk99UtilgetUserId(sRetCode, sRetMsg)
End If

ChkLogIn = sPar_UserId

End Function




Answer this question

vb6 to vb .net showdialog() exception

  • aCiD2

    I found the error.. on the load sub in vb99_login I was opening a file and getting the parameter from it. I had an error handling the stream reader. =)

  • vb6 to vb .net showdialog() exception