borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (making a button do ...)Next Topic (MS Access & ASP?) New Topic New Poll Post Reply
AndreaVB Forum : Internet Applications : Doing a post to a browser using VB
Poster Message
Ranjit
Level: Guest


icon Doing a post to a browser using VB

HI all,
I am trying to do a post to a web browser using VB.
The basic is that I am trying to verify if a post to a web browser returns true, I need to do certain things or else I need to give an alert to the user saying that Web server is down or Post failed.

Also is it possible to create an HTM document on the fly using VB? The user needs this so that he can attach this document in his e-mail and the recipient can open up as a HTML doc.

thanks in advance for any suggestions or help.
ranjit

30-01-2003 at 11:05 PM
| Quote Reply
vbgen
Level: Moderator

Registered: 10-10-2002
Posts: 876
icon Re: Doing a post to a browser using VB

Welcome, Ranjit.

if i got it right, the html on the fly would be referring to asp, which is also vbscripting, allowing you to create an html through coding...

the first part of your post i din't get yet...
i'm not sure what you mean... could you explain a bit further? if it's ok with you.

sorry very

____________________________
Been busy trying to take a second degree <--it's not working out...

30-01-2003 at 11:50 PM
View Profile Send Email to User Show All Posts | Quote Reply
Ranjit
Level: Guest

icon Re: Doing a post to a browser using VB

Ok I will try again, am not sure weather I am explaining it well or not.
Say suppose I have a pre constructed HTML page can I do a post/submit the above *HTML* page via VB 6.0(not VBScript).Coz there seems to ba way in C++(Which I could'nt find) so I am thinking is there a way to do this in VB.

As far as the second part I totally failed in explaining.
Here is what I am trying to do. I need to retrive some info from DB, File system...
Right now I am putting that in a raw format in a .txt file, so the user suggested me that it would nice to have an HTML doc(yeh right!!!) for all the cosmetic purpose , hence the pain.

Hope I am clear now and not making you   , thanks for the reply.

ranjit

31-01-2003 at 04:52 PM
| Quote Reply
vbgen
Level: Moderator

Registered: 10-10-2002
Posts: 876
icon Re: Doing a post to a browser using VB

here's what i can give you for now...

i'm not so sure i got it with the first one...
but, if you want vb6 programming, and not vbscript, well i'd have to ask... what is the scenario? is it that you want your program to make your preconstructed html page viewable on the webbrowser control in a form? i'll probably wait for your post on this..

for the second, using vbscript to get db info i believe you want this viewed on a site, right?

if so, then you would need a recordset paging asp file, which i can provide for you:

<%@ LANGUAGE = "VBSCRIPT" %>
<% OPTION EXPLICIT %>
<html>
<head><TITLE>Recordset Paging</TITLE>
</head>
<body>
<div align="center">
<table width="600">
<tr>
<td width="450" valign="top"
  <%
      Dim databaseConnection, openDatabase
      Set databaseConnection=Server.CreateObject("ADODB.Connection")
      openDatabase="driver={Microsoft Access Driver (*.mdb)};" & _
              "dbq=" & Server.MapPath("database.mdb")
      databaseConnection.Open openDatabase

      Dim CurPage, records, RowCount, i, PageChoice
      CurPage = Request.QueryString("page")
      If CurPage = "" Then CurPage = 1
      Set records = Server.CreateObject("ADODB.Recordset")
      records.CursorType = 3
      PageChoice = Request.QueryString("PageChoice")
      If PageChoice = "" Then
      records.PageSize = 5
      Else
      records.PageSize = PageChoice
      End If
      records.Open "SELECT field1, field2, field3 FROM fields", databaseConnection
      records.AbsolutePage = CInt(CurPage)
      RowCount = 0
   %>
<table border = "1">
<tr>
<td>field1</td>
<td>field2</td>
<td>field3</td>
</tr>
   <% WHILE NOT records.EOF and RowCount < records.PageSize %>
<tr>
<td><%= records("field1") %> </td>
<td><%= records("field2") %> </td>
<td><%= records("field3") %> </td>
</tr>
<%
RowCount = RowCount + 1
records.MoveNext
   Wend
   %>
</table>
<p>Jump to page:
<% For i = 1 to records.PageCount %>
<a href="paging.asp?page=<%=i%>&PageChoice=<%ageChoice%>"><%=i%></a>
<% Next %>
</p>
<form action="paging.asp?page=1" name="rows" method="get">
How many Records per Page? <select name="PageChoice">
<option value="5">5</option>
<option value="7">7</option>
<option value="10">10</option>
</select>
<input type="submit" value="Submit">
</form>
<%
records.Close
Set records = Nothing
databaseConnection.Close
Set databaseConnection = Nothing
%>
</td>
</tr>
</table>
</div>
</body>
</html>


can you adapt to this code? i hope so.
this code was at this link:
http://www.andreavb.com/forum/viewtopic.php?TopicID=881

okidokie? post back, ayt? and don't worry,    isn't happening... yet.  

____________________________
Been busy trying to take a second degree <--it's not working out...

31-01-2003 at 08:22 PM
View Profile Send Email to User Show All Posts | Quote Reply
Ranjit
Level: Guest

icon Re: Doing a post to a browser using VB

Forget the first problem, I guess there is no way in VB doing that.

Second one is I am simply trying to construct a HTML page programmatically(on the fly).
The page might have data from DB or from reading a text file.The example code in your post explains how to page through the record set, that will slove me if data is from a DB, not from a text file(if text file you may ask me to do FSO file system object).
Consider this scnario...
I want to construct a HTML(on the fly again) page and the data would be the result of say...
File xx copied from source to target.Similarly folder ff moved from Location A to C(this is just an example), so these things are not stored in any DB and also I need to write to a file format(this case lets say HTML)as and when it happens.

Hope this is more clear of what I am doing.
Pls do not hesitate to ask any more details.
and thank you for your patience.
later
Ranjit

03-02-2003 at 04:52 PM
| Quote Reply
vbgen
Level: Moderator

Registered: 10-10-2002
Posts: 876
icon Re: Doing a post to a browser using VB

what do you mean?

do you want to display on the html file that folder this was moved from here to there?

how about the text file? if you want to read from that, well, your right... i would suggest that you use fso(filesystemobject) to read the data inside the text file, then write it on the html page accordingly...

displaying the result of the text file question can be done with vb, like that of the post i gave you, but instead of reading from a recordset, use fso to read from the file..

post back asap to clarify some more.    thanks.

____________________________
Been busy trying to take a second degree <--it's not working out...

03-02-2003 at 06:22 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Internet Applications : Doing a post to a browser using VB
Previous Topic (making a button do ...)Next Topic (MS Access & ASP?) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder