My problem is that i want to develop a project in which there is front end (window form) in vb .net in which there are diffrent field for book entry name,author,image etc. all this data is stored in back end sql server 2005

there is drop down list of books name the user select the name of book & click a button to generate HTML page of that book which include all information can anybody help me suugest how to do or any help is welcome.

thanks in advance

You can add your HTML template into the resources like that:
name: html
value:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>$filename</title>
<body> here comes the $book or $textsearch</body>
</head>

if the user have clicked the button you just do:

Private Sub CreateHTML(ByVal _file As String)
Dim sw As New IO.StreamWriter(_file)
        Dim header As String = My.Resources.html
        header = header.Replace("$filename", _file)
        header = header.Replace("$book", cmbGame.SelectedItem.ToString())
        header = header.Replace("$txtsearch", txtvalue)
        sw.WriteLine(header)
sw.close
end Sub
Comments
Very Helpful

Thanks GeekByChoiCe for ur reply

i am newbie to programming what did you mean by adding html in resources please explain how to do

thanks again bro

Thanks GeekByChoiCe

Your Reply is really helpful

Here is the solution

private void CreateHTML(int SelectedRow)
        {
           

            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            saveFileDialog1.Filter = "HTML Image|*.html";
            saveFileDialog1.Title = "Save an HTML File";
            saveFileDialog1.ShowDialog();

            // If the file name is not an empty string open it for saving.
            if (saveFileDialog1.FileName != "")
            {
                

                System.IO.StreamWriter sw = new StreamWriter(saveFileDialog1.FileName);

                string header = Read.Worthy.Publication.Properties.Resources.HTML;
                header = header.Replace("$author", DGViewSearchResult.Rows[SelectedRow].Cells["Author_Name"].Value.ToString());
                header = header.Replace("$book", DGViewSearchResult.Rows[SelectedRow].Cells["Title"].Value.ToString());
                header = header.Replace("$physicaldescription", DGViewSearchResult.Rows[SelectedRow].Cells["Physical_Dimention"].Value.ToString());
                header = header.Replace("$isbn", DGViewSearchResult.Rows[SelectedRow].Cells["ISBN13"].Value.ToString());
                header = header.Replace("$company", DGViewSearchResult.Rows[SelectedRow].Cells["Company"].Value.ToString());

                header = header.Replace("$year", DGViewSearchResult.Rows[SelectedRow].Cells["Year"].Value.ToString());
                header = header.Replace("$priceinr", DGViewSearchResult.Rows[SelectedRow].Cells["PriceINR"].Value.ToString());

                header = header.Replace("$priceusd", DGViewSearchResult.Rows[SelectedRow].Cells["PriceUSD"].Value.ToString());
                header = header.Replace("$subject", DGViewSearchResult.Rows[SelectedRow].Cells["Subject"].Value.ToString());

                header = header.Replace("$aboutbook", DGViewSearchResult.Rows[SelectedRow].Cells["About_Book"].Value.ToString());
                header = header.Replace("$content", DGViewSearchResult.Rows[SelectedRow].Cells["Content"].Value.ToString());




               
                sw.Write(header);
                
                sw.Close();
            }
        }

Hey

One new problem is occured i am able to generate HTML page with text or string but in html there is a Cover image which ia also different for each book & stored in sql database as image type

how can i pass this image to html file at run time like i passed string value

Dim header As String = My.Resources.html 
header = header.Replace("$filename", _file)        
header = header.Replace("$book", cmbGame.SelectedItem.ToString())        header = header.Replace("$txtsearch", txtvalue)

please help

This article has been dead for over six months. Start a new discussion instead.