PDA

View Full Version : سوال: دریافت اطلاعات از Web Page و نمایش آن در Form (همراه نمونه کد !؟! )



gilsoft
سه شنبه 25 بهمن 1390, 06:04 صبح
سلام دوستان
من میخوام از کد زیر استفاده کنم و اونو داخل یک فرم نمایش بدم ... اول کد رو ملاحظه بفرمایید :
کد مربوط به وب سایت accuweather
لینک وب سایت : http://netweather.accuweather.com/adcbin/netweather_v2/signup-page3.asp

<div style='width: 435px; height: 90px; background-image: url( http://vortex.accuweather.com/adcbin/netweather_v2/backgrounds/spring1_435x90_bg.jpg ); background-repeat: no-repeat; background-color: #607041;' ><div id='NetweatherContainer' style='height: 75px;' ><script src='http://netweather.accuweather.com/adcbin/netweather_v2/netweatherV2ex.asp?partner=netweather&tStyle=normal&logo=1&zipcode=MEA|IR|IR008|RASHT|&lang=uke&size=10&theme=spring1&metric=1&target=_self'></script></div><div style='text-align: center; font-family: arial, helvetica, verdana, sans-serif; font-size: 10px; line-height: 15px; color: #FDEA11;' ><a style='color: #FDEA11' href='http://www.accuweather.com/world-index-forecast.asp?partner=netweather&locCode=MEA|IR|IR008|RASHT|&metric=1' >Forecast</a> | <a style='color: #FDEA11' href='http://www.accuweather.com/maps-satellite.asp' >Maps</a> | <a style='color: #FDEA11' href='http://www.accuweather.com/index-radar.asp?partner=accuweather&zipcode=MEA|IR|IR008|RASHT|' >Radar</a></div><img style='float: right; padding-right: 5px;' src='http://vortex.accuweather.com/adc2004/common/images/misc/netweather_v2/adcwhite.png' /><div style='clear: both;' /></div></div>

کد مربوط به وب سایت Yahoo! Weather
لینک وب سایت : http://weather.yahoo.com/badge/config/

<!-- Yahoo! Weather Badge --><iframe allowtransparency="true" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no" src="http://weather.yahoo.com/badge/?id=2255086&u=c&t=trans&l=navigation" height="35px" width="350px"></iframe><noscript><a href="http://weather.yahoo.com/iran/gilan/rasht-2255086/">Rasht Weather</a> from <a href="http://weather.yahoo.com">Yahoo! Weather</a></noscript><!-- Yahoo! Weather Badge -->
متاسفانه نمیدونم که از این کد چگونه باید استفاده کنم !؟! :متفکر: :افسرده: :ناراحت:
خروجی این کد رو میتونید از این لینک ببینید : http://netweather.accuweather.com/adcbin/netweather_v2/signup-page3.asp

جهت روش شدن مطلب، این لینک رو هم ملاحظه بفرمایید : http://barnamenevis.org/showthread.php?322932-%D8%A2%D8%A8-%D9%88-%D9%87%D9%88%D8%A7-http-www.irimo.ir-farsi-RSS-xml.asp&p=1435258&viewfull=1#post1435258

اینو باید جایی تحویل بدم (بعنوان نمونه کار) خواهشا اگه کسی نحوه استفاده از کد فوق رو میدونه .. برام توضیح بده .. ممنون و سپاسگزارم.

فرید نجفلو
سه شنبه 25 بهمن 1390, 12:10 عصر
شما اول یک کنترل WebBrowser به فرمتون اضافه و کد زیر رو بزارید:
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
WebBrowser1.DocumentText =<div style='width: 435px; height: 90px; background-image: url( http://vortex.accuweather.com/adcbin/netweather_v2/backgrounds/spring1_435x90_bg.jpg ); background-repeat: no-repeat; background-color: #607041;' ><div id='NetweatherContainer' style='height: 75px;' ><script src='http://netweather.accuweather.com/adcbin/netweather_v2/netweatherV2ex.asp?partner=netweather&tStyle=norma l&logo=1&zipcode=MEA|IR|IR008|RASHT|&lang=uke&size =10&theme=spring1&metric=1&target=_self'></script></div><div style='text-align: center; font-family: arial, helvetica, verdana, sans-serif; font-size: 10px; line-height: 15px; color: #FDEA11;' ><a style='color: #FDEA11' href='http://www.accuweather.com/world-index-forecast.asp?partner=netweather&locCode=MEA|IR|IR0 08|RASHT|&metric=1' >Forecast</a> | <a style='color: #FDEA11' href='http://www.accuweather.com/maps-satellite.asp' >Maps</a> | <a style='color: #FDEA11' href='http://www.accuweather.com/index-radar.asp?partner=accuweather&zipcode=MEA|IR|IR008 |RASHT|' >Radar</a></div><img style='float: right; padding-right: 5px;' src='http://vortex.accuweather.com/adc2004/common/images/misc/netweather_v2/adcwhite.png' /><div style='clear: both;' /></div></div>
WebBrowser1.Refresh()
End Sub

درواقع اون کد Html رو به WebBrowser1.DocumentText اختصاص داده و رفرش می کنید

gilsoft
سه شنبه 25 بهمن 1390, 16:25 عصر
شما اول یک کنترل WebBrowser به فرمتون اضافه و کد زیر رو بزارید:
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
WebBrowser1.DocumentText =<div style='width: 435px; height: 90px; background-image: url( http://vortex.accuweather.com/adcbin/netweather_v2/backgrounds/spring1_435x90_bg.jpg ); background-repeat: no-repeat; background-color: #607041;' ><div id='NetweatherContainer' style='height: 75px;' ><script src='http://netweather.accuweather.com/adcbin/netweather_v2/netweatherV2ex.asp?partner=netweather&tStyle=norma l&logo=1&zipcode=MEA|IR|IR008|RASHT|&lang=uke&size =10&theme=spring1&metric=1&target=_self'></script></div><div style='text-align: center; font-family: arial, helvetica, verdana, sans-serif; font-size: 10px; line-height: 15px; color: #FDEA11;' ><a style='color: #FDEA11' href='http://www.accuweather.com/world-index-forecast.asp?partner=netweather&locCode=MEA|IR|IR0 08|RASHT|&metric=1' >Forecast</a> | <a style='color: #FDEA11' href='http://www.accuweather.com/maps-satellite.asp' >Maps</a> | <a style='color: #FDEA11' href='http://www.accuweather.com/index-radar.asp?partner=accuweather&zipcode=MEA|IR|IR008 |RASHT|' >Radar</a></div><img style='float: right; padding-right: 5px;' src='http://vortex.accuweather.com/adc2004/common/images/misc/netweather_v2/adcwhite.png' /><div style='clear: both;' /></div></div>
WebBrowser1.Refresh()
End Sub

درواقع اون کد Html رو به WebBrowser1.DocumentText اختصاص داده و رفرش می کنید

سلام دوست عزیز
ممنون از راهنمایی تون :تشویق: :تشویق: :تشویق: :تشویق: :تشویق:
من کد فوق رو بشکل زیر تکمیل کردم تا سایر دوستان بتونند ازش استفاده استفاده کنند.
این کد برای سایز width: 435px; height: 90px در رشته DocumentText میباشد.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
With WebBrowser1
.AllowNavigation = False
.AllowWebBrowserDrop = False
.IsWebBrowserContextMenuEnabled = False
.ScrollBarsEnabled = False
.Size = New Size(455, 130)
.DocumentText = "<div style='width: 435px; height: 90px; background-image: url( http://vortex.accuweather.com/adcbin/netweather_v2/backgrounds/winter1_435x90_bg.jpg ); background-repeat: no-repeat; background-color: #7CADEE;' ><div style='height: 75px;' ><object type='application/x-shockwave-flash' data='http://netweather.accuweather.com/adcbin/netweather_v2/netwx-v210.swf' height='75' width='435' align='top'> <param name='movie' value='http://netweather.accuweather.com/adcbin/netweather_v2/netwx-v210.swf' /> <param name='allowScriptAccess' value='never' /> <param name='allowNetworking' value='internal' /> <param name='quality' value='high' /> <param name='scale' value='noscale' /> <param name='salign' value='lt' /> <param name='wmode' value='transparent' /> <param name='bgcolor' value='#ffffff' /> <param name='flashvars' value='partner=netweather&myspace=1&logo=1&tStyle=normal&zipcode=MEA|IR|IR008|RASHT|&lang=uke&size=210&theme=1&metric=1' /></object></div><div style='text-align: center; font-family: arial, helvetica, verdana, sans-serif; font-size: 10px; color: #0000FF;' ><a style='color: #0000FF' href='http://www.accuweather.com/world-index-forecast.asp?partner=netweather&locCode=MEA|IR|IR008|RASHT|&metric=1' >Forecast</a> | <a style='color: #0000FF' href='http://www.accuweather.com/maps-satellite.asp' >Maps</a> | <a style='color: #0000FF' href='http://www.accuweather.com/index-radar.asp?partner=accuweather&zipcode=MEA|IR|IR008|RASHT|' >Radar</a></div><img style='float: right; padding-right: 5px;' src='http://vortex.accuweather.com/adc2004/common/images/misc/netweather_v2/adcwhite.png' /><div style='clear: both;' /></div></div>"
.Refresh()
End With
End Sub

gilsoft
پنج شنبه 28 فروردین 1393, 20:07 عصر
سلام دوست عزیز
ممنون از راهنمایی تون :تشویق: :تشویق: :تشویق: :تشویق: :تشویق:
من کد فوق رو بشکل زیر تکمیل کردم تا سایر دوستان بتونند ازش استفاده استفاده کنند.
این کد برای سایز width: 435px; height: 90px در رشته DocumentText میباشد.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
With WebBrowser1
.AllowNavigation = False
.AllowWebBrowserDrop = False
.IsWebBrowserContextMenuEnabled = False
.ScrollBarsEnabled = False
.Size = New Size(455, 130)
.DocumentText = "<div style='width: 435px; height: 90px; background-image: url( http://vortex.accuweather.com/adcbin/netweather_v2/backgrounds/winter1_435x90_bg.jpg ); background-repeat: no-repeat; background-color: #7CADEE;' ><div style='height: 75px;' ><object type='application/x-shockwave-flash' data='http://netweather.accuweather.com/adcbin/netweather_v2/netwx-v210.swf' height='75' width='435' align='top'> <param name='movie' value='http://netweather.accuweather.com/adcbin/netweather_v2/netwx-v210.swf' /> <param name='allowScriptAccess' value='never' /> <param name='allowNetworking' value='internal' /> <param name='quality' value='high' /> <param name='scale' value='noscale' /> <param name='salign' value='lt' /> <param name='wmode' value='transparent' /> <param name='bgcolor' value='#ffffff' /> <param name='flashvars' value='partner=netweather&myspace=1&logo=1&tStyle=normal&zipcode=MEA|IR|IR008|RASHT|&lang=uke&size=210&theme=1&metric=1' /></object></div><div style='text-align: center; font-family: arial, helvetica, verdana, sans-serif; font-size: 10px; color: #0000FF;' ><a style='color: #0000FF' href='http://www.accuweather.com/world-index-forecast.asp?partner=netweather&locCode=MEA|IR|IR008|RASHT|&metric=1' >Forecast</a> | <a style='color: #0000FF' href='http://www.accuweather.com/maps-satellite.asp' >Maps</a> | <a style='color: #0000FF' href='http://www.accuweather.com/index-radar.asp?partner=accuweather&zipcode=MEA|IR|IR008|RASHT|' >Radar</a></div><img style='float: right; padding-right: 5px;' src='http://vortex.accuweather.com/adc2004/common/images/misc/netweather_v2/adcwhite.png' /><div style='clear: both;' /></div></div>"
.Refresh()
End With
End Sub

سلام دوستان

نمیدونم چرا هنگام اجرای کد فوق با خطای زیر مواجه میشم ؟ :ناراحت: :متعجب: :متفکر:

قبلا خوب کار می‌کرد !!

به نظر شما چه باید کرد ؟؟؟‌ :متفکر: :متفکر: :متفکر:

ROSTAM2
پنج شنبه 28 فروردین 1393, 21:35 عصر
فکر کنم خصوصیتی با نام ScriptError یا چیزی تو همین مایه ها فعال هست برای همین هم این پنجره به دلیل خطای Script نشون داده شده!