VB.NET WebBrowser1'de seçeneklerin güzel görünmesini stil dosyası ile nasıl sağlarım?

Vatansever

Asistan
Katılım
23 Ağustos 2007
Mesajlar
405
Reaksiyon puanı
1
Puanları
18
Arkadaşlar Bir DatagridView ve birde WebBrowser1 var datagridview'den bir satırı seçince seçenekler WebBrowser1'de görüntüleniyor ama ben görsellik kattım biraz altta kodu var ama ben html kodunu txtbox'lara yazıp programın içine atmak istiyorum kullanıcı ayarlardan hangi stil dosyasını seçerse bundaki bilgiler alınacak ve datagridview'de seçilmiş bilgiler bu koddaki yerlerine konulup WebBrowser1'de görüntülensin bunu nasıl yaparım?



HTML:
                Dim yazı As String = "<html>" & vbNewLine _
                                     & "<body background=" & Application.StartupPath & "/Template/backgrnd.jpg>" & vbNewLine _
                                     & "<H2><CENTER><B>" & Me.DataGridView1.Rows(konum.RowIndex).Cells("strProgram").Value.ToString & "</B></CENTER></H2>" & vbNewLine _
                                     & "<b>Version: </b>" & Me.DataGridView1.Rows(konum.RowIndex).Cells("strVersion").Value.ToString & "<br>" & vbNewLine _
                                     & "<b>Company: </b>" & Me.DataGridView1.Rows(konum.RowIndex).Cells("strCompany").Value.ToString & "<br>" & vbNewLine _
                                     & "<b>URL: </b><a href=" & Me.DataGridView1.Rows(konum.RowIndex).Cells("strURL").Value.ToString & ">" & Me.DataGridView1.Rows(konum.RowIndex).Cells("strURL").Value.ToString & "</a href><br><br>" & vbNewLine _
                                     & Me.DataGridView1.Rows(konum.RowIndex).Cells("strInfo").Value.ToString & vbNewLine _
                                     & "</html>" & vbNewLine

                Me.WebBrowser1.DocumentText = yazı


örnek stil dosyası
HTML:
<html>
<body background="%I/backgrnd.jpg">
<H2><CENTER><B>%P</B></CENTER></H2>
<b>Version: </b>%V<br>
<b>Company: </b>%C<br>
<b>URL: </b><a href=%U>%U</a href><br><br>
%S
</html>
 

Vatansever

Asistan
Katılım
23 Ağustos 2007
Mesajlar
405
Reaksiyon puanı
1
Puanları
18
Problemi çözdüm

KOD1:
Kod:
                Try
                    Dim myString As String = File.ReadAllText(Application.StartupPath & "\Template\Default.stl", Encoding.UTF8)
                    Dim finalString As String = "" 'Nothing
                    finalString = myString.Replace("%I", Application.StartupPath & "/Template")
                    myString = finalString
                    finalString = myString.Replace("%P", Me.DataGridView1.Rows(konum.RowIndex).Cells("strProgram").Value.ToString)
                    myString = finalString
                    finalString = myString.Replace("%V", Me.DataGridView1.Rows(konum.RowIndex).Cells("strVersion").Value.ToString)
                    myString = finalString
                    finalString = myString.Replace("%C", Me.DataGridView1.Rows(konum.RowIndex).Cells("strCompany").Value.ToString)
                    myString = finalString
                    finalString = myString.Replace("%U", Me.DataGridView1.Rows(konum.RowIndex).Cells("strURL").Value.ToString)
                    myString = finalString
                    finalString = myString.Replace("%S", Me.DataGridView1.Rows(konum.RowIndex).Cells("strInfo").Value.ToString)

                    Me.WebBrowser1.DocumentText = finalString
                Catch ex As Exception

                End Try
KOD2:
Kod:
                Dim FileText As String = File.ReadAllText(Application.StartupPath & "\Template\Default.stl")
                Try
                    FileText = Replace(FileText, "%I", Application.StartupPath & "/Template")
                    FileText = Replace(FileText, "%P", Me.DataGridView1.Rows(konum.RowIndex).Cells("strProgram").Value.ToString)
                    FileText = Replace(FileText, "%V", Me.DataGridView1.Rows(konum.RowIndex).Cells("strVersion").Value.ToString)
                    FileText = Replace(FileText, "%C", Me.DataGridView1.Rows(konum.RowIndex).Cells("strCompany").Value.ToString)
                    FileText = Replace(FileText, "%U", Me.DataGridView1.Rows(konum.RowIndex).Cells("strURL").Value.ToString)
                    FileText = Replace(FileText, "%S", Me.DataGridView1.Rows(konum.RowIndex).Cells("strInfo").Value.ToString)

                    Me.WebBrowser1.DocumentText = FileText
                Catch ex As Exception

                End Try
 
Üst