1
Answer

Simple VB 2005 question, please help

jon dyne

jon dyne

14y
2.2k
1
Hi,

For a university project i am developing a piece of open source software, TULP2G.  I have downloaded it and it builds in visual studio 2005 no problem. 

However, when I make changes to the tool, e.g. change the words on a form, i hit F5, it builds but does not show my edit to the program.  It just shows the original program. 

Any ideas would be VERY helpful.

Thanks,
Jon.
Answers (1)
0
Ken Barrett

Ken Barrett

NA 173 0 15y
Looks as if I figured it out.  It may not be the most elegant solution, but it seems to work.. and I understand it.

By number of entries  I meant that the number of entries that are in the guest book are variable. This depends on how many people have signed it.  So the number of entries that are shown on the view guest book page depends on how many people have signed the guest book.

The way I solved this was first to include a html span on the web page. As in :
<!-- start guest book entries -->
<span id="GBentries" runat=server></span>


Then I used a data reader (I like data readers because I'm old fashioned) to load only the date, name, and comments out of the data table. There's a lot more data in there, but I only want to display these items.  As in :
  private int getGBentries() {
    int rows = 0 ;
    string cmd = "SELECT Date, Name, Comments FROM dbo.Guest" ;
    using (SqlConnection gconn = new SqlConnection(dbConn))
    {
      try {
        gconn.Open() ;
        SqlCommand Scmd = new SqlCommand(cmd, gconn);
        SqlDataReader dr = Scmd.ExecuteReader() ;
        while(dr.Read()) {
          GuestEntry ge = new GuestEntry((DateTime)dr["Date"],
                            (string)dr["Name"],(string)dr["Comments"]) ;
          entries.Push(ge) ; // build a stack to be used later
          rows++ ;
        }
        dr.Close() ;
        gconn.Close() ;
        return(rows) ;
      } catch {
        return(0) ;
      }
    }
  }


As each item was read in a string object was appended with a new html table to hold that particular entry.  As in :
  private void buildEntries() {
    foreach (GuestEntry ge in entries) {
      guestOut +=
        "<table width=800 cellpadding=8>\n" +
        "  <tr><td colspan=2><hr /></td></tr>\n" +
        "  <tr>\n" +
        "    <td width=200>Date</td>\n" +
        "    <td width=600>" + ge.getCommentDate().Date + "</td>\n" +
        "  </tr>\n" +
        "  <tr>\n" +
        "    <td width=200>Name</td>\n" +
        "    <td width=600>" + ge.getName() + "</td>\n" +
        "  </tr>\n" +
        "  <tr>\n" +
        "    <td width=200>Comments</td>\n" +
        "    <td width=600>" + ge.getComment() + "</td>\n" +
        "  </tr>\n" +
        "</table>\n" ;
    }
  }


Then the string was written out to the span id on the web page. As in :
  protected void Page_Load(object sender, EventArgs e) {
    getGBentries() ;
    buildEntries() ;
    GBentries.InnerHtml = guestOut ;
  }

0
Roei Bar

Roei Bar

NA 7.8k 0 15y
by saying number of entries, do you want the number of entries in the Guestbook or the number of entries to that page?

the number of entries in the guestbook is easy, use databindNavigator it will give you all the data you return for you to manipulate and also you can know how many entries or more truly to say how many rows you have...

for number of entries to page you need  a counter control that you can download all over