السلام عليكم
لدي ملف مرفوع علي موقع pastebin فيه روابط لصور مباشرة https://pastebin.com/raw/6au4aJGx
ده رابط الصور مباشرة عاوز كود مثلا 1 يستدعي الصورة الاولي 2 يستدعي الصورة الثانية وهكذا
اتمني ان حد يكون فهم قصدي
انا املك كود ولكن يجلب النصوص فقط هذا هو
كود :
Dim hwr As System.Net.HttpWebRequest = DirectCast(System.Net.WebRequest.Create("https://pastebin.com/raw/6au4aJGx"), System.Net.HttpWebRequest)
hwr.Method = "GET"
Dim names As List(Of String) = New List(Of String)()
Using hwResponse As System.Net.HttpWebResponse = DirectCast(hwr.GetResponse(), System.Net.HttpWebResponse)
Using stream As IO.Stream = hwResponse.GetResponseStream()
Using reader As StreamReader = New StreamReader(stream)
While Not reader.EndOfStream
names.Add(reader.ReadLine())
End While
End Using
End Using
End Using
textbox1.Text = names(0)
textbox2.Text = names(1)
textbox3.Text = names(2)
Imports System.Text Imports System.Text.RegularExpressions Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click ListBox1.Items.Clear() Dim url As String = "https://pastebin.com/raw/6au4aJGx" Using wc As New Net.WebClient wc.Encoding = Encoding.UTF8 Dim html As String = wc.DownloadString(url)
Dim str As String = "https.*?\.png" Dim reg As New Regex(str) Dim mc As MatchCollection = reg.Matches(html) Dim ma As Match For Each ma In mc If ma.Success Then ListBox1.Items.Add(ma.Value) End If Next End Using End Sub Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged PictureBox1.Load(ListBox1.Text) End Sub End Class
(04-11-20, 12:36 AM)سعود كتب : وعليكم السلام ورحمة الله و بركاته
PHP كود :
Imports System.Text Imports System.Text.RegularExpressions Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click ListBox1.Items.Clear() Dim url As String = "https://pastebin.com/raw/6au4aJGx" Using wc As New Net.WebClient wc.Encoding = Encoding.UTF8 Dim html As String = wc.DownloadString(url)
Dim str As String = "https.*?\.png" Dim reg As New Regex(str) Dim mc As MatchCollection = reg.Matches(html) Dim ma As Match For Each ma In mc If ma.Success Then ListBox1.Items.Add(ma.Value) End If Next End Using End Sub Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged PictureBox1.Load(ListBox1.Text) End Sub End Class
شكرا لك اخي سعود ولكن طلبي هو ان يبقا في عدد 6 picturebox موجودين في الفورم عاوز مثلا picturebox1 يسترد الصورة رقم 1 و picturebox 2 يسترد الصورة رقم 2 هكذا بدون listbox واشكرك جدا
(04-11-20, 12:36 AM)سعود كتب : وعليكم السلام ورحمة الله و بركاته
PHP كود :
Imports System.Text Imports System.Text.RegularExpressions Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click ListBox1.Items.Clear() Dim url As String = "https://pastebin.com/raw/6au4aJGx" Using wc As New Net.WebClient wc.Encoding = Encoding.UTF8 Dim html As String = wc.DownloadString(url)
Dim str As String = "https.*?\.png" Dim reg As New Regex(str) Dim mc As MatchCollection = reg.Matches(html) Dim ma As Match For Each ma In mc If ma.Success Then ListBox1.Items.Add(ma.Value) End If Next End Using End Sub Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged PictureBox1.Load(ListBox1.Text) End Sub End Class
شكرا لك اخي سعود ولكن طلبي هو ان يبقا في عدد 6 picturebox موجودين في الفورم عاوز مثلا picturebox1 يسترد الصورة رقم 1 و picturebox 2 يسترد الصورة رقم 2 هكذا بدون listbox واشكرك جدا
المطلوب ابسط
حاول فيها قبل لا اكتب الطريقة اللي قلت لي عليها.
لان عندنا الان تجميع collection اعرف العدد count وابدا من الصفر...
مثلا:
Imports System.Text Imports System.Text.RegularExpressions Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim url As String = "https://pastebin.com/raw/6au4aJGx" Using wc As New Net.WebClient wc.Encoding = Encoding.UTF8 Dim html As String = wc.DownloadString(url) Dim str As String = "https.*?\.png" Dim reg As New Regex(str) Dim mc As MatchCollection = reg.Matches(html) p1.Load(mc(0).Value) p2.Load(mc(1).Value) p3.Load(mc(2).Value) p4.Load(mc(3).Value) p5.Load(mc(4).Value) p6.Load(mc(5).Value) End Using End Sub End Class
04-11-20, 09:24 PM (آخر تعديل لهذه المشاركة : 04-11-20, 09:25 PM {2} بواسطة ميدو الفنان.)
(04-11-20, 01:18 AM)سعود كتب :
(04-11-20, 01:10 AM)ميدو الفنان كتب :
(04-11-20, 12:36 AM)سعود كتب : وعليكم السلام ورحمة الله و بركاته
PHP كود :
Imports System.Text Imports System.Text.RegularExpressions Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click ListBox1.Items.Clear() Dim url As String = "https://pastebin.com/raw/6au4aJGx" Using wc As New Net.WebClient wc.Encoding = Encoding.UTF8 Dim html As String = wc.DownloadString(url)
Dim str As String = "https.*?\.png" Dim reg As New Regex(str) Dim mc As MatchCollection = reg.Matches(html) Dim ma As Match For Each ma In mc If ma.Success Then ListBox1.Items.Add(ma.Value) End If Next End Using End Sub Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged PictureBox1.Load(ListBox1.Text) End Sub End Class
شكرا لك اخي سعود ولكن طلبي هو ان يبقا في عدد 6 picturebox موجودين في الفورم عاوز مثلا picturebox1 يسترد الصورة رقم 1 و picturebox 2 يسترد الصورة رقم 2 هكذا بدون listbox واشكرك جدا
المطلوب ابسط
حاول فيها قبل لا اكتب الطريقة اللي قلت لي عليها.
لان عندنا الان تجميع collection اعرف العدد count وابدا من الصفر...
مثلا:
PHP كود :
pic1.load(mc(0)) pic2.load(mc(1))
وهكذا
شكرا ليك اخي الكريم <3
(04-11-20, 01:24 AM)kiki كتب : فقط كل ما هو عليك استبدال هذا السطر
PHP كود :
ListBox1.Items.Add(ma.Value)
بسطر يخص الاداء الصورة
او ازالة الجزء ده كاملاً
PHP كود :
For Each ma In mc If ma.Success Then ListBox1.Items.Add(ma.Value) End If Next
بكود مكون من 6 اسطر وهو السطر الاول لـ picturebox1 حتى السطر السادس لـ picturebox6
من غلال اعطاء القيمة بهذا الشكل
PHP كود :
mc(0).Value : mc(5).Value
اتمنى يكون شرحة مبسط ليس لدي على الجهاز الحالى نسخة لكي اقوم بتحرير الكود واعادته لك
شكرا لك الان فهمت اخي
(04-11-20, 01:27 AM)سعود كتب :
PHP كود :
Imports System.Text Imports System.Text.RegularExpressions Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim url As String = "https://pastebin.com/raw/6au4aJGx" Using wc As New Net.WebClient wc.Encoding = Encoding.UTF8 Dim html As String = wc.DownloadString(url) Dim str As String = "https.*?\.png" Dim reg As New Regex(str) Dim mc As MatchCollection = reg.Matches(html) p1.Load(mc(0).Value) p2.Load(mc(1).Value) p3.Load(mc(2).Value) p4.Load(mc(3).Value) p5.Load(mc(4).Value) p6.Load(mc(5).Value) End Using End Sub End Class
كل الصور زي بعض
شكرا لك علي الكود كامل وجزاك الله خيرا
(04-11-20, 03:01 AM)ابو روضة كتب :
وهذا تعديل على كود الأخ سعود
عشان لو أضفت صور مرة أخرى يكون الكود كامل بأمر الله...
تم استخدام FlowLayoutPanel
والله انك مبدع اخي ابو روضة شكرا لك وجعله الله في ميزان حسناتك