Distributing is a PAIN...

genu

Well-known member
Joined
Jun 9, 2005
Messages
94
Programming Experience
1-3
ok I just finished a program, and when I try it on my laptop it doesnt work. I get some weird error. then I serach the forums instructions when distributing, and then I find a post that I have to get the Microsoft .NET Framework Version 1.1 Redistributable Package. SO I get that and install it and the target machine(laptop). I run the program AGAIN and it still doesnt work..this time with a different error;

THE SECOND ERROR:
"Application has generated an exception that could not be handled.
Process id=0xc10(3088), Thread id=0xf6c(3948).

Click OK to terminate the appication.
Click Cancel to debug the application.

I think its rediculous..that I havent able to distribute a single application to another computer....unless there is only like one command button and one textbox in the whole program.

on the targed machine I just transferred everything in the BIN folder

HERE IS THE PROGRAM and THE SORUCE..thanks...please clear my mind...because what use is a program that will only run on one computer........
 

Attachments

  • WindowsApplication5.zip
    76.2 KB · Views: 82
  • bin.zip
    65.7 KB · Views: 54
I haven't tried this, and I'm sure there must be a better way, but I'd think that you could use a Microsoft Web Browser control that you don't actually show on your form and then get the source for the page it is displaying. As I said, I haven't tried it so I'm assuming that you can get the source for the page.
 
Wait a minute ... i don't see the reason of using that com object if you are able to get content in only couple lines of code ... you can pass any html code to the textbox with StreamReader class ... check this out http://www.vbdotnetforums.com/showthread.php?t=3699
it reads from css but the trick is the same ... Cheers ;)
 
kulrom said:
Wait a minute ... i don't see the reason of using that com object if you are able to get content in only couple lines of code ... you can pass any html code to the textbox with StreamReader class ... check this out http://www.vbdotnetforums.com/showthread.php?t=3699
it reads from css but the trick is the same ... Cheers ;)
I think genu wants to get his file off the Internet. You can't pass a StreamReader a URL can you? It would be great if you can but a StreamReader can only read local or networked files can't it?
 
However, you can take a look at the entire project "read html code from net"

Hapy coding ;)

this is the code for the lazy ones:

PHP:
Private Sub getTheHtmlContent_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles getTheHtmlContent.Click

Dim myURL As String = txtURL.Text 

Dim webreq As HttpWebRequest

webreq = System.Net.HttpWebRequest.Create(myURL)

'also you can go like this

'webreq = System.Net.HttpWebRequest.Create("http://www.vbdotnetforums.com")

Dim webresp As HttpWebResponse

webresp = webreq.GetResponse()

Dim strm As StreamReader = New StreamReader(webresp.GetResponseStream(), Encoding.ASCII)

Dim sLine As String

sLine = strm.ReadToEnd

txtNet.Text = sLine

strm.Close()

End Sub
 

Attachments

  • readFromNet.zip
    24.8 KB · Views: 86
kulrom just to inform you the text property of txtURL is "http:\\www.vbdotnetforums.com" which isnt a valid web address
 
kulrom said:
However, you can take a look at the entire project "read html code from net"

Hapy coding ;)

this is the code for the lazy ones:

PHP:
Private Sub getTheHtmlContent_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles getTheHtmlContent.Click

Dim myURL As String = txtURL.Text 

Dim webreq As HttpWebRequest

webreq = System.Net.HttpWebRequest.Create(myURL)

'also you can go like this

'webreq = System.Net.HttpWebRequest.Create("http://www.vbdotnetforums.com")

Dim webresp As HttpWebResponse

webresp = webreq.GetResponse()

Dim strm As StreamReader = New StreamReader(webresp.GetResponseStream(), Encoding.ASCII)

Dim sLine As String

sLine = strm.ReadToEnd

txtNet.Text = sLine

strm.Close()

End Sub
Hey!! Are you calling me lazy? I appreciate the effort. :)
 
that works..but when I was using the inet control...that advanage there was that It was part of internet explorer and that way I can go to a site in IE, login in....and the use my program to open the html page that you can only access if youre logged in....so it works with IE.
 
I'm no expert in web related stuff but I'm quite sure that there is a way to do waht you want using the System.Net namespace. I've recently read a little bit more about the Inet control. It was VB6 and doesn't exist in VB.NET. I'm afraid you need to come to terms with the fact that it is gone and find a new way to achieve the same result.
 
ok here is the deal...I played around with the TRY and msgboxes...and here is what I have come up with:

I added two message boxes to show:

VB.NET:
#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()
        MsgBox("started") [B]'HERE[/B]
        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call
        MsgBox("started") [B]'AND HERE[/B]
    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub
...ETC

When I run this version of the program on my laption(other machine) it displays the first message box and then It gives me the error that I stated before...so i doesnt even get to the second message box...So there must be someting wrong with InitializeComponent()....any suggestions?
 
Perhaps you need to put a breakpoint on that line and then step into InitializeComponent when execution stops there. When execution stops at at breakpoint, you press F10 to step to the next line, F11 to step into a property or method on the current line, or Shift+F11 to step out of the current property or method.
 
The IitializeComponent procedure (by default) includes a tag which causes the debugger to step through said procedure, that tag is: <System.Diagnostics.DebuggerStepThrough()> . One would need to remove that tag or place a breakpoint inside the InitializeComponent procedure if you want to step through the InitializeComponent procedure.

Also, it would make since that the code would fail during the initialization of the inet control for all the reasons jmcilhinney has put forth.
 
Paszt said:
The IitializeComponent procedure (by default) includes a tag which causes the debugger to step through said procedure, that tag is: <System.Diagnostics.DebuggerStepThrough()> . One would need to remove that tag or place a breakpoint inside the InitializeComponent procedure if you want to step through the InitializeComponent procedure.

Also, it would make since that the code would fail during the initialization of the inet control for all the reasons jmcilhinney has put forth.
That I didn't know, but now that you mention it it makes perfect sense. :)
 
Back
Top