REF DE OBJ NÃO DEFINIDA PARA UMA INSTANCIA DE OBJ

NICKOLASCARLOS 28/03/2014 19:18:22
#436669
Alguem podia me dizer oq tem de errado neste codigo:?
obs: esté é o codigo do form que não está abrindo
  Option Explicit On
Option Strict On

Imports System
Imports System.String
Imports System.Text
Imports System.Threading
Imports System.IO.Path

Public Class Form2
Dim complurl As String = (RandomString(intMaxChars, True))
Dim fi As New System.IO.FileInfo(OpenFileDialog1.filename)
Dim intMaxChars As Integer = 16
Dim th1 As Thread
Dim user As String = [Ô]u30---*:\)495[Ô]
Dim pass As String = [Ô]Mi*66A??S[Ô]


Private Function RandomString(ByVal size As Integer, ByVal lowerCase As Boolean) As String
Dim builder As New StringBuilder()
Dim random As New Random()
Dim ch As Char
Dim i As Integer

For i = 0 To size - 1
ch = Convert.ToChar(Convert.ToInt32((25 * random.NextDouble() + 65)))
builder.Append(ch)
Next

If lowerCase Then
Return builder.ToString().ToUpper()
Else
Return builder.ToString()
End If
End Function
Private Sub upload0()
Me.Hide()
Form3.Show()


Try
Dim client As New Net.WebClient
client.Credentials = New Net.NetworkCredential(user, pass)
client.UploadFile([Ô]ftp://www.indexnetwork.tk/[Ô] & My.Settings.user & [Ô]/[Ô] & complurl & [Ô]file[Ô], TextBox1.Text)
Dim lfdown As String = ([Ô]ftp://www.indexnetwork.tk/[Ô] & My.Settings.user & [Ô]/[Ô] & complurl & [Ô]file[Ô])
RichTextBox1.Text = RichTextBox1.Text.Replace([Ô]?VFILENAME[Ô], fi.Name)
RichTextBox1.Text = RichTextBox1.Text.Replace([Ô]?VBYAC[Ô], My.Settings.user)
RichTextBox1.Text = RichTextBox1.Text.Replace([Ô]?VDESCR[Ô], RichTextBox2.Text)
RichTextBox1.Text = RichTextBox1.Text.Replace([Ô]?VEXT[Ô], fi.Extension.ToString)
RichTextBox1.Text = RichTextBox1.Text.Replace([Ô]?VWE[Ô], fi.Length.ToString)
RichTextBox1.Text = RichTextBox1.Text.Replace([Ô]?VLFDOWN[Ô], lfdown)

Try

client.Credentials = New Net.NetworkCredential(user, pass)
client.UploadString([Ô]ftp://www.indexnetwork.tk/[Ô] & My.Settings.user & [Ô]/[Ô] & complurl & [Ô].htm[Ô], RichTextBox1.Text)
Me.Show()
Form3.Close()
MsgBox([Ô]O link para a página do download de seu arquivo é este:[Ô] & [Ô]http://www.indexnetwork.tk/[Ô] & My.Settings.user & [Ô]/[Ô] & complurl & [Ô].htm[Ô], MsgBoxStyle.SystemModal)
My.Computer.Clipboard.SetText([Ô]http://www.indexnetwork.tk/[Ô] & My.Settings.user & [Ô]/[Ô] & complurl & [Ô].htm[Ô], TextDataFormat.Text)
MsgBox([Ô]O Link para a página de download foi copiado para o seu CTRL + V[Ô], MsgBoxStyle.SystemModal)

Catch ex As Exception
MsgBox([Ô]Desculpe! Não foi possivel gerar a pagina![Ô], MsgBoxStyle.Critical, [Ô]Error![Ô])
End Try
Catch ex As Exception
MsgBox([Ô]Desculpe! Não foi possivel fazer o upload do arquivo![Ô], MsgBoxStyle.Critical, [Ô]Error![Ô])
End Try
End Sub
Private Sub upload()

End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
OpenFileDialog1.ShowDialog()
TextBox1.Text = OpenFileDialog1.FileName
End Sub

Private Sub UploadToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UploadToolStripMenuItem.Click
th1 = New Thread(AddressOf upload0)
th1.Start()

End Sub

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub
End Class
NILSONTRES 28/03/2014 19:23:24
#436670
Qual a linha do erro ?
NICKOLASCARLOS 28/03/2014 19:26:31
#436671
Citação:

:
Qual a linha do erro ?


Cara esse é o problema o vb não indica qual o erro no form!
ADHEL 28/03/2014 19:59:31
#436672
Resposta escolhida
Remova essa linha.
Citação:

Dim fi As New System.IO.FileInfo(OpenFileDialog1.filename)



e coloque nessa parte abaixo.

Citação:

Private Sub upload0()
Me.Hide()
Form3.Show()

Tópico encerrado , respostas não são mais permitidas