منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب
[سؤال] كيف نغير قيم بواسطة HtmlAgilityPack - نسخة قابلة للطباعة

+- منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب (http://vb4arb.com/vb)
+-- قسم : قسم لغة الفيجوال بيسك VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=182)
+--- قسم : قسم اسئلة VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=183)
+--- الموضوع : [سؤال] كيف نغير قيم بواسطة HtmlAgilityPack (/showthread.php?tid=2524)



كيف نغير قيم بواسطة HtmlAgilityPack - سعود - 10-04-14

مثلا لدي هذا السطر
كود :
<img src="" />
كيف احدث مابين علامتي التنصيص لاضع رابط صورة من كود فيجوال بيسك ؟

نفس السؤال لـ div كيف اسند له نص بالكود

مصدر الصفحة هكذا
كود :
<head>
    <style type="text/css">
        .style1 {
            width: 90%;
            border-style: solid;
            border-width: 1px;
        }
    </style>
</head>
<table align="center" class="style1" dir="rtl">
    <tr>
        <td bgcolor="ActiveBorder" style="text-align: center">
            مثال لتقرير بواسطة تش ام ال</td>
    </tr>
    <tr>
        <td>
            &nbsp;
            <img id="pic" alt="" src="" height="231px" width="231px" />
            </td>
    </tr>
    <tr>
        <td id="aname">
            &nbsp;</td>
    </tr>
    <tr>
        <td id="mo">
            &nbsp;</td>
    </tr>
    <tr>
        <td id="mail">
            &nbsp;</td>
    </tr>
    <tr>
        <td>
            &nbsp;</td>
    </tr>
    <tr>
        <td bgcolor="ActiveBorder" style="text-align: center">
            مع تحيات اخيكم سعود</td>
    </tr>
</table>


وهذا كود المحاولة
كود :
Dim html As String = Application.StartupPath & "\aprint.htm"
        Dim hweb As New HtmlAgilityPack.HtmlWeb
        Dim doc As New HtmlAgilityPack.HtmlDocument
        doc.Load(html)
        Dim nod As HtmlAgilityPack.HtmlNode = doc.GetElementbyId("pic")
        Dim src As HtmlAgilityPack.HtmlAttribute = nod.Attributes("src")

        nod.SetAttributeValue(src.Value, "pics/" & picname)
        doc.Save(Application.StartupPath & "\aprint.htm")



RE: كيف نغير قيم بواسطة HtmlAgilityPack - سعود - 10-04-14

ياسلام عرفت للصورة وهي هكذا بعد التعديل
كود :
'احضار ارتباط الصورة لتحديث القيمة
        'Dim nod As HtmlAgilityPack.HtmlNode = doc.GetElementbyId("pic")
        'Dim src As HtmlAgilityPack.HtmlAttribute = nod.Attributes("src")
        'nod.SetAttributeValue("src", "pics/" & picname)

لكن كيف لعناصر الـ td
كيف نحدث المحتوى
كود :
<td id="aname">
            saud</td>