Label Text per FTP ändern!

  • VB.NET

Es gibt 26 Antworten in diesem Thema. Der letzte Beitrag () ist von InstantBlood.

    Label Text per FTP ändern!

    Hi,
    ich bin auf der Suche nach einem ganz einfachen Code, der Code soll den Label Text ändern per FTP.

    Also ich stell mir das so vor:
    Pfad zu einer Datei --> WW.XXXXX.XX/DATEI.TXT
    Und der Inhalt von dieser Datei soll dann im Label angezeigt werden.


    VB.NET-Quellcode

    1. Label1.Text = ("Status: HIER DER TEXT VOM FTP")
    2. WriteLog("Status: HIER DER TEXT VOM LABEL")
    Dann machs mit dem Webbrowser der in VB mitgebracht wird.

    Damit liest du einfach das DocumentText aus und dieses gibst du dann in deinem Label wieder.

    Beispiel_

    VB.NET-Quellcode

    1. Dim browser As New Webbrowser
    2. Dim text As browser.DocumentText = "Dein Link"
    3. Label1.Text = text


    Das ist nur ein Beispiel obs funktioniert kann ich nich sagen is ausm Kopf geschrieben

    Nur wenn die Datei über nen Webbrowser erreichbar ist.
    Per FTP direkt lesen wüsste ich nicht ob das geht oO
    Es war einmal ein kleiner Bär... der wollte eine Geschichte hörn... Da erzählte ihm seine Mutti:
    Es war einmal ein kleiner Bär... der wollte eine Geschichte hörn... Da erzählte ihm seine Mutti:
    Es war einmal ein kleiner Bär... der wollte eine Geschichte hörn... Da erzählte ihm seine Mutti:
    ... Nun solltest es selber wissen. :'D

    Patrick1993 schrieb:

    Dann machs mit dem Webbrowser der in VB mitgebracht wird.

    Damit liest du einfach das DocumentText aus und dieses gibst du dann in deinem Label wieder.

    Beispiel_

    VB.NET-Quellcode

    1. Dim browser As New Webbrowser
    2. Dim text As browser.DocumentText = "Dein Link"
    3. Label1.Text = text


    Das ist nur ein Beispiel obs funktioniert kann ich nich sagen is ausm Kopf geschrieben


    Der Code ergibt keinen Sinn :O
    Logisch.

    Du machst dir nen Browser ohne das Control:

    VB.NET-Quellcode

    1. Dim browser As New WebBrowser


    Navigierst zu deiner Seite:

    VB.NET-Quellcode

    1. browser.Navigate = "Dein Link"


    Liest damit deine Textdatei aus:

    VB.NET-Quellcode

    1. label1.text = browser.documentText


    Was soll da keinen sinn ergeben ?
    Probiers doch einfach aus bevor du behauptest es ergebe keinen sinn

    Wenn du immer die erste zeile auslesen willst, dann lass <html> und den Doctype weg

    Warum schreibst du in eine Textdatei einen Doctype ?

    und dieses "Hier gibt's nichts" wird nich ausgegeben ?

    Hast du deinen Link so: domain.de/index.txt geschrieben oder domain.de/index.html ?

    gib die Adresse ut tetsdatei mal in deinem Normalen Browser (Firefox o.ä) ein.
    Wenn du dann den Inhalt der Textdatei lesen kannst poste mal deinen Code

    Das ist aber das einzige was in der .txt ist!
    Hier gibts nichts :)




    Quellcode:

    HTML-Quellcode

    1. <html><head></head><body>Hier gibts nichts :)<!-- START --><noscript>&lt;div style="display:none"&gt;&amp;nbsp;&lt;/div&gt;</noscript><script type="text/javascript" async="" src="http://www.google-analytics.com/ga.js"></script><script type="text/javascript" src="http://media.funpic.de/layer.php?bid=2136649266"></script><div id="lc1ov0srdt" class="lc1ov0srdt" style="top: -3000px; display: none; left: -1970px; "><div id="Fvq3sfo58jjzw"><span id="sy6ypc4Q">&nbsp;<a href="#" id="PhssnlgcjqdxT">x</a>&nbsp;&nbsp;<a href="http://www.funpic.de/?layer" id="Wzdzj1ethd" target="_blank">Funpic.de</a></span><span id="Bl0n7jkK"><a href="#" id="Yg5htpz0keH">schliessen x</a>&nbsp;</span><br></div><div id="Du7rcqyy5sf0k"><iframe frameborder="0" id="qsspkrvuccagP" src="http://media.funpic.de/close.php?bid=2136649266&amp;action=cr&amp;rand=7686"></iframe></div></div><style type="text/css"> .lc1ov0srdt { display:none; position: fixed; top: 30px; left: 30px; text-align: center ! important; background-color: #ffffff ! important; border: 1px solid # ! important; z-index: 100000 ! important; width: 300px ! important; height: 318px; ! important margin: 0 ! important; padding: 0 ! important; letter-spacing: 0 ! important; text-indent: 0; ! important } .lc1ov0srdt div { margin: 0 ! important; padding: 0 ! important; } .lc1ov0srdt a { z-index: 100015 ! important; position: static ! important; font: 13px verdana, arial, helvetica, sans-serif ! important; font-weight: 500 ! important; color: #FFFFFF ! important; text-decoration: none ! important; margin: 0 ! important; padding: 0 ! important; border: 0 ! important; } .lc1ov0srdt #PhssnlgcjqdxT { color: #FFFFFF ! important; background-color: #7baf1f ! important; z-index: 100011 ! important; font-weight: bold ! important; } .lc1ov0srdt #Wzdzj1ethd { color: #FFFFFF ! important; background-color: #7baf1f ! important; z-index: 100011 ! important; font-weight: bold ! important; } .lc1ov0srdt #Yg5htpz0keH { color: #FFFFFF ! important; background-color: #7baf1f ! important; z-index: 100011 ! important; font-weight: bold ! important; } .lc1ov0srdt #Fudhu83yyk { color: #FFFFFF ! important; background-color: #7baf1f ! important; z-index: 100011 ! important; font-weight: bold ! important; } .lc1ov0srdt #Zp0y1ngvV { color: #FFFFFF ! important; background-color: #7baf1f ! important; z-index: 100011 ! important; font-weight: bold ! important; } .lc1ov0srdt #sy6ypc4Q { float: left ! important; height: 18px ! important; font: 13px verdana, arial, helvetica, sans-serif ! important; font-weight: 500 ! important; color: #FFFFFF ! important; background-color: #7baf1f ! important; text-decoration: none ! important; margin: 0 ! important; padding: 0 ! important; border: 0 ! important; overflow: hidden ! important; z-index: 100008 ! important; } .lc1ov0srdt #Bl0n7jkK { float: right ! important; height: 18px ! important; font: 13px verdana, arial, helvetica, sans-serif ! important; font-weight: 500 ! important; color: #FFFFFF ! important; background-color: #7baf1f ! important; text-decoration: none ! important; margin: 0 ! important; padding: 0 ! important; border: 0 ! important; overflow: hidden ! important; z-index: 100012 ! important; } .lc1ov0srdt #Fvq3sfo58jjzw { width: 100% ! important; height: 18px ! important; font: 13px verdana, arial, helvetica, sans-serif ! important; font-weight: 500 ! important; color: #FFFFFF ! important; background-color: #7baf1f ! important; text-decoration: none ! important; margin: 0 ! important; padding: 0 ! important; border-bottom: 1px solid # ! important; overflow: hidden ! important; z-index: 100006 ! important; } .lc1ov0srdt #Du7rcqyy5sf0k { width: 100% ! important; height: 299px ! important; background-color: #FFFFFF ! important; margin: 0 ! important; padding: 0 ! important; border: 0 ! important; z-index: 100003 ! important; } .lc1ov0srdt #qsspkrvuccagP { width: 100% ! important; height: 100% ! important; background-color: #FFFFFF ! important; margin: 0 ! important; padding: 0 ! important; border: 0 ! important; z-index: 100004 ! important; }</style><!--[if lte IE 7]><style type="text/css"> .lc1ov0srdt { position: absolute; }</style><![endif]--><!--[if lte IE 8]><style type="text/css"> .lc1ov0srdt { position: absolute; }</style><![endif]--><!--[if lte IE 9]><style type="text/css"> .lc1ov0srdt { position: absolute; }</style><![endif]--><a href="http://funpic.de/troubleacoustic.php"><!-- measure-due 1332258609--></a><!-- End --><script type="text/javascript">
    2. var _gaq = _gaq || [];
    3. _gaq.push(['_setAccount', 'UA-16106315-4']);
    4. _gaq.push(['_setDomainName', '.funpic.de']);
    5. _gaq.push(['_trackPageview']);
    6. (function() {
    7. var ga = document.createElement('script'); ga.type = 'text/javascript';
    8. ga.async = true;
    9. ga.src = ('https:' == document.location.protocol ? 'https://ssl' :
    10. 'http://www') + '.google-analytics.com/ga.js';
    11. var s = document.getElementsByTagName('script')[0];
    12. s.parentNode.insertBefore(ga, s);
    13. })();
    14. </script></body></html>
    Ich hatte von deinem VB Code gesprochen nich von dem Quellcode der Seite

    VB.NET-Quellcode

    1. Dim browser As New WebBrowser


    VB.NET-Quellcode

    1. If ComboBox1.Text = "...." Then
    2. If ....
    3. ElseIf .....
    4. End If
    5. WriteLog(".....")
    6. Label2.Visible = True
    7. browser.Navigate("*****/****/1.txt")
    8. Label2.Text = browser.DocumentText
    9. End If


    ^^