Comatose 290 Taboo Programmer Team Colleague

Some of it could be done in Javascript, and some of it could be done on a server side language, such as Perl (CGI) or PHP. Does the server that you are hosting your site on allow server side programs?

Comatose 290 Taboo Programmer Team Colleague

The reason you are getting this error, is because the for loop loads the new objects (in our case, shapes). So instead of a using a for loop like this:

For i = 1 To CInt(Text1.Text)
     Load Shape1(i)
     Shape1(i).Visible = True
     Shape1(i).Left = Shape1(0).Left + (Shape1(0).Width * (i Mod 5))
     Shape1(i).Top = Shape1(0).Top + (Shape1(0).Height * Fix(i / 5))
Next i

You could declare a form-wide, or global (or even static) variable, that will keep track of which element you are on. Let me show you what happens: You say for i =1 to cint(text1.text). That says loop from 1 to the number in the textbox. Let's pretend it's 5. So, it loads shape1(1), shape1(2), shape1(3), shape1(4) and shape1(5). right? Now they are loaded and on the form. When you click the button again, it does the for loop again, and tries to load shape1(1), shape1(2), etc, etc.... but they are already loaded! We loaded them the first time! So, we create a variable (one that will not change when the sub is complete, so a form-wide variable is good. In the declaration section of the form, do this:

public SCount as integer

and in the form load:

SCount = 1;

Now, We Can keep adding 1 to SCount every time the for loop cycles. This will keep track of where we leave off, so let's try this code in the button:

Shape1(0).Visible = True
    If IsNumeric(Text1.Text) Then
        For i = SCount To CInt(Text1.Text)
            Load Shape1(i) …
Comatose 290 Taboo Programmer Team Colleague

Oh and one other thing. I know a lot more about vB.NET than what you do. I passed the exam last year. So I know what I am talking about.

So because you passed an exam last year, you obviously know more than he does about it?

Comatose 290 Taboo Programmer Team Colleague

that script would require 2 pages, yes, but it's simple to change window.location="highres.html"; to whatever you want to actually do in the event that res is set to whatever resolution we have.... this is just an example of how to check for the resolution.

Comatose 290 Taboo Programmer Team Colleague

you could try checking out this code:

<SCRIPT language="JavaScript">
<!--
if ((screen.width>=1024) && (screen.height>=768))
{
 window.location="highres.html";
}
else
{
  window.location="lowres.html";
}
//-->
</SCRIPT>
Comatose 290 Taboo Programmer Team Colleague

I know that anything is possible, but I have no idea how you would go about accomplishing such a task. If you know the format, you could read it as binary, and save it in the specified format, but I don't know what that format is.

Comatose 290 Taboo Programmer Team Colleague

Do you have code that actually works with the excel spreadsheet, and you are having trouble figuring out the colors, or are you having trouble figuring out how to work with the spreadsheet period?

Comatose 290 Taboo Programmer Team Colleague

If you set the database objects that you use to reference your database to nothing, and then whenever you want to have them refresh, just recreate the objects, and pass it another query. That should effectively load the new information.

Comatose 290 Taboo Programmer Team Colleague

I'm not sure if this what you are looking for, but have you looked at crystal reports?

Comatose 290 Taboo Programmer Team Colleague

Have you checked out this tutorial:
http://www.timesheetsmts.com/adotutorial.htm?

Comatose 290 Taboo Programmer Team Colleague

Could you be a little more specific, and possibly attach the project and database?

Comatose 290 Taboo Programmer Team Colleague

I don't understand all of your question. I gather that you want to have a textbox, and a command button, and when they type a number into the textbox, and click the button, to display that number of shapes right?

Comatose 290 Taboo Programmer Team Colleague

While that is an awesome idea, not unless you use something like cute or wsftp. With those, I'm not even sure that you can make them do it... I know that the ftp system that come with Windows don't offer you such an option, and what he needs done is very simple. So downloading a whole package like wsftp is going to take more Ram, and hard-drive space than is really necessary for such a simple task. All of the automatic FTP downloaders that I have seen are trial versions, and may also come up with splashscreens and other annoyances.

Comatose 290 Taboo Programmer Team Colleague

Ok, The solution to the date format has been resolved. What I had to do was set a temporary variable to equal the date as it is, and then use that to set it to a new format date. The Date setup in your database is m/dd/yyyy, which I converted in code to MMMM/dd/yyyy. Then, I converted That To The New Setup Date dd/MMMM/yyyy. Here is the code how I went about doing this:

tmpdate = Format$(rs!Date, "MMMM/dd/yyyy")
ndate = Format(tmpdate, "dd/MMMM/yyyy")

Now, this is all well and dandy, but we still have a real big problem, (and this is the reason for the type mismatch error), is that your variable, Value's is declared in the code above as a single. When we change the date from all numbers (m/dd/yyyy) to a mixture of letters and numbers (dd/MMMM/yyyy), this new value becomes a string! A String! So, unfortunately, since the variable is defined as a single, it can not hold or contain a string. You also use that 2 dimensional array, as the reference to your chart itself. If you were able to change the Values array, it will impact the chart, because (from what I can tell) the chart is in need of an array of single's. I'm still trying to find a workaround, but have been so far unsuccessful. However, finding the problem is sometimes the hardest part.... and that part is done!

Comatose 290 Taboo Programmer Team Colleague

Here is the link to the web design tutorials: http://www.daniweb.com/techtalkforums/forum76.html, I have posted 2 of the intended 4 tutorials there, and hope you find the time to go over them. Yeah, You can call me Coma!

Ps. I read and try to respond to most posts that I know something about. I know C/C++, and ASM, but I don't code it enough any more to be proficient enough to answer most questions about it, so I stick to the stuff I use a lot! :)

Comatose 290 Taboo Programmer Team Colleague

Yes, Please attach the zip so that I can fiddle with it. Along with your database (or one similar without any confidential information).

Comatose 290 Taboo Programmer Team Colleague

Prelude
In the last tutorial, we covered a basic skeleton of a small CGI in Perl. It didn't do much, other than check if the user tried to go directly to the CGI, or if they were submitting information to us through a page. This doesn't do us a whole lot of good, when it comes to retrieving actual information. So, Now What? The answer is simple. We'll Use Param.

Param
When a web page is submitted, it uses 1 of 2 methods. Either GET or POST. With the Param function of CGI.pm, it doesn't really matter which method is used to pass the information to be submitted, as long as something is being submitted. Now, We Can Read That Information...As Long As We Know The Name Of The Form Element We Want To Read! While I, very well may be telepathic, the programs I write are not. So, if we don't know the name of the form element, we can't retrieve it's value. Plain and simple. If, however, you built the HTML Page that is submitting it's information to our CGI, then you should know the name of the form element. Let's Pretend that we have a web page, that has 2 textbox's and a submit button. The name of the first textbox, is "fname" for first name, and the name of the second textbox is "lname" for last name. Joe Someguy, has entered his information into the page, and has pressed submit! All …

Comatose 290 Taboo Programmer Team Colleague

I was unable to edit my previous post in order to include a link to the first tutorial in the Perl/CGI Series, So I apologize for double-posting, but I had no other option. The Link to the tutorial on checking for data with a perl CGI is: http://www.daniweb.com/tutorials/tutorial21269.html, and I will be writing more tutorials as a step by step.

Comatose 290 Taboo Programmer Team Colleague

My Pleasure! :)

Comatose 290 Taboo Programmer Team Colleague

Prelude
Perl is an excellent language, versatile, powerful, and not too difficult to learn. I'm not going to go into detail about Perl, and explain why we have to put #!/usr/bin/perl on the first line, or how using modules work, but I will explain how to check for information from a web page with this tutorial. If this tutorial gets is a little bigger than you expect, I apologize, but I tend to get a bit long winded when it comes to great subjects. So, without any further delay.

Preparation
One thing about Perl CGI's, is making sure that we include CGI.pm. This simplifies a lot of information for us (such as parsing headers, and printing headers), and makes our programming experience with CGI's taste a little better. So, we have to use the CGI module to give us these functions. How do we do that? Real Easy, We Tell Perl We Want To use the standard functions of the CGI Module like so:

#!/usr/bin/perl

use CGI qw(:standard);

Check For Submission
Ok, so we have some functions that help us out. Now what? Well, one thing that we have to do is to see if our CGI (Perl Script) is being called by another page (Through a submit) or if someone decided to get a little too enthusiastic, and stuck our CGI URL directly into their web browser. If Mr. Anxious decided to navigate directly to our CGI, we have a couple of options. We …

Comatose 290 Taboo Programmer Team Colleague

Sorry RS.... the problem with that is that is would violate security measures that have been built into the browsers. I suppose if the users turn their security settings down, this message won't come up, but developers decided that it was too much of a risk to security to offer that on any kind of secure setting. These Message are supposed to be warnings for the user, and because of that, remote access to them would be a breach of that security. Sorry.

I Have Been Planning, and Will be, however, writing a tutorial shortly on Perl/CGI's. I'm going to cover reading data from a submitted web page, saving that data to a file, and also having the CGI e-mail the owner of the site. I'll make sure to add the link to this post when I have completed the tutorial.

Comatose 290 Taboo Programmer Team Colleague

Well, Think about it like this... The Date, in the format of dd/mmmm/yyyy is going to try to format the date as something like this: 01/0004/2005 (most likely). Now, another option is, have you tried to remove the format$? So it would be set to something like: Values(i, 1) = rs!Date and try that as text.... since the date in the database is already set to the format you want, just try to load the date as a string into the cell. Let me know if that works.

Comatose 290 Taboo Programmer Team Colleague

Sham,

I beg to differ. While VB.net does offer inheritance... creating a control array takes pages and more code. The actual term "control array" doesn't even account for anything in .NET. Try doing a search of google for "vb.net control arrays" and there are tons of pages that describe the differences between a VB6 Instantiation of a control, versus VB.Net's. In order to avoid any kind of debate regarding the issue of taking 1 control, and making multiple with it, I have attached a VB6 Project that at design time, has 1 shape. That shape's index property is set to 0. Then, The form load creates more instances of the shape, and positions them nicely next to each other.

Comatose 290 Taboo Programmer Team Colleague

In The Declaration Section Of Your Form (Or In A Module) Add

Dim CCount as Integer

Then in your form_load (or button, or wherever) add this:

CCount = CCount + 1
load shapename(CCount)
shapename.Visible = true

That should work. Keep In Mind You'll Probably Need To Change shapename to the name of your shape.

Comatose 290 Taboo Programmer Team Colleague

And Beyond That, Chances are that if you get the error message (about the system administrator disabling things) attempting to change the registry probably won't work. It may let you change it, but I bet if you close regedit, and open it back up again, the value will be what it was before you changed it ;)

Comatose 290 Taboo Programmer Team Colleague

Just A Thought Here, Couldn't You Get The Referer With Javascript (like document.referer), and doesn't it return an entire URL? If this is so, couldn't you split the string (or use substr) and grap the protocol, and check for http: or https: and act accordingly?

Comatose 290 Taboo Programmer Team Colleague

I suppose you could do a

somevariable = window.location;

and then do a substr or substring on the url, and see if it's in there. There might be an easier way, but that's probably how I'd do it.

Comatose 290 Taboo Programmer Team Colleague

Let me give you a breakdown of the situation. A Web Page, Is stored on a server. A Server is a computer that is usually online all the time, and can offer some kind of connection (such as e-mail, a web page, ftp, etc). Your PC (most likely, the computer you are reading this post from), DOES NOT (unless you are really hosting your own web server), have your web page files stored on it (and if so, probably not the ones that people are viewing). Now, This web server (the computer that has your web pages on it), can run programs. You can create programs, that run on that computer, but have no effect on the computer you are surfing with right now. The computer (the server) that is hosting your web pages, probably is running unix of some kind. Perl, is a programming language, that comes with unix. PHP, is a programming language (well, it's an HTML Preprocessor, but to avoid confusion) that can be installed on the server to offer you that ability. CGI, stands for common gateway interface. This can, ultimately, be programmed in any language, that the server (the one that is storing and running your web page) understands and accepts. These "Server Side Programming" Languages, affect your web site. They can read information from the web page, and do a great number of things with it. They can store it in a file (ON THE SERVER [The one that is hosting your page]), send …

Comatose 290 Taboo Programmer Team Colleague

Ok, I'm Moving this thread to VB.Net

Comatose 290 Taboo Programmer Team Colleague

Have you checked to see that directory.getcurrentdirectory is returning the proper path, or returning anything at all? Also, After some long hours of headache and painful study, Visal and I found that passing data to WSH's Run Method that contains spaces (in VB6, We Tried App.Path ) forces it to error, because it doesn't properly render the spaces. A Solution for you to look into is:


Dim myProcess As Process = System.Diagnostics.Process.Start(Directory.GetCurrentDirectory + "\GetSigw.exe /3 " + Directory.GetCurrentDirectory + "\SigAVA.bmp")

or something similar and along those lines. The WSH's Run Method is great, if you can throw in a bunch of chr(34)'s around your directory.getcurrentdirectory's, but I think this procedure will be more effective for you.

Comatose 290 Taboo Programmer Team Colleague

Yeah, If you could help me with a clearer picture... or even zip and attach the project so we can see what you are doing, that would be outstanding!

Comatose 290 Taboo Programmer Team Colleague

Well.... I'm not 100% sure how you planned on getting the sign up information from point A (The server) To Point B (your pc), and then storing it in an access DB, But, How _I_ would go about such a task, would be to use VB.

Comatose 290 Taboo Programmer Team Colleague

I personally prefer Perl to PHP, and I feel that CGI is the best way to go. I'm not sure if you know any VB or any thing like that (for getting the info from the server to your PC). I've already figured a fairly simple solution from getting the info to your PC. The hardest part now, is making the CGI to save the info.

Comatose 290 Taboo Programmer Team Colleague

Unless VB.Net has a mouse off event (which it might, I don't know), The answer is "there isn't one". I know VB6 doesn't have one. The only way to find out if the mouse has gone off the form is to use an api call. You need to use the getcursorpos api, and pass it the POINTAPI Type. This will effectively give you the current X Y coordinates of the mouse.
Then, you get the current X, Y coordinates of your form (maybe using getwindowrect, with type RECT), and then compare to see if the mouse falls within those boundaries. If it is within those boundaries, the mouse is on the form. If it's not, then it isn't. So you could use a timer control, and check every millisecond where the mouse is. As long as it's on your form, set a variable to true. When it leaves your form, set it false, and execute some kind of "off form" code. Another option, is to set a global hook on the mouse, and whenever you recieve a WM_MOUSEMOVE, check it's coordinates, compare, and execute.

As for the checksum, I found This neat information:
http://www.vbaccelerator.com/home/VB/Code/Libraries/CRC32/article.asp

Comatose 290 Taboo Programmer Team Colleague

I need a little more information than that! Mouse Off? Like, when the mouse leaves the form?

Comatose 290 Taboo Programmer Team Colleague

Ok, Here is the skeleton outline of a server. You specifiy a port number, and click listen, and it will accept connections on that port. Right now, it's very simple. A Client can connect on the specified port, and send data.... the server program (attached) will accept whatever is sent, and display that information in a msgbox. This is the basic structure of a server in VB. It's fully commented for ease of use, readability, and understandability. Remember, You need to download and install catalyst socketwrench (freeware edition) in order for this server to work.

Comatose 290 Taboo Programmer Team Colleague

I think Visal Hit the nail on the head with that one..... it's easiest to use a checkbox with the style set to graphical...

Comatose 290 Taboo Programmer Team Colleague

ok, re-read his orignal post, and yep, I guess that I missed that part
*oops*
well, why not php it? set up a simple DB, single table, contains;
D&T stamp
1st Name
2nd Name
E-mail
Tel #
Details of work,

still instead of Mailto, use send/post etc to add to DB..... I think you can dump data from a php DB straight to txt deliminated files, then upload into access..... maybe access can reach into php?

Maybe. Either way, the hardest part is going to be getting the information from the server to the pc automagically. Once the information is on the PC (which is the goal), then it doesn't matter how you go about getting it into access. You could build an access macro to do it, or have the program do it.

Comatose 290 Taboo Programmer Team Colleague

Do you have any code written already.... if so post it.

Comatose 290 Taboo Programmer Team Colleague

Sure, but would they be honest?

Comatose 290 Taboo Programmer Team Colleague

I usually sign them, but in case you were wondering, I gave you the one for the example project.

Comatose 290 Taboo Programmer Team Colleague

He already has it coming to him in E-mail. I think the whole idea is to avoid having it sent by e-mail.... otherwise, he could leave it like it is, and strip the details into an access database... right?

Comatose 290 Taboo Programmer Team Colleague

Ok,

I have written, and commented a server written in VB6 with catalyst socketwrench. This program listens on port 135 for a connection. If it recieves a connection, it accepts the connection momentarily (long enough to grab the IP and the Hostname), then immediately disconnects. It Writes The Date, Time, IP Address and Hostname of the computer that tried to make the connection to a log file, and displays a "notification" window similar to that of MSN Messengers Notification window (when you recieve an IM, or someone logs on). I have attached and Included the needed socket control, the complete and commented source code, along with a zip file that contains an installation program should you feel more comfortable using it instead of compiling it yourself.

Now, Be Advised that this program will not work in windows XP as long as you have other programs that listen on port 135. This is the procedure that I had to follow in order to make sure that this program would listen on port 135 (otherwise, you'll get an error that says something along the lines of: this address is already in use). In XP Home edition:
Click Start
Click Run
Type in: services.msc
Then in the pane on the right, find: Distributed Transaction Coordinator
Right click on it, and choose properties, and set "Startup Type" to disabled.
and Hit ok. Do the same thing for:
TCP/IP NetBIOS Helper
Task Scheduler
and

Comatose 290 Taboo Programmer Team Colleague

This is a limitation of all the VB's that I know of. I'm trying to find a less complicated way to accomplish what Visal had posted... but it looks like his plan so far is the best. I've still got a couple of tricks up my sleeve, that I'm trying to work out right now, and I'll let you know what I come up with. I don't believe vendors still carry VB6, but I'm sure you can find a copy on Ebay.

Comatose 290 Taboo Programmer Team Colleague

The hard part isn't importing the delimited text files into access. The hard part is getting the user entered information from the server to your PC. Once it's on your PC, you can have access import it, or make the program import it into access. Again, the tough part, is getting it from server to pc.

Comatose 290 Taboo Programmer Team Colleague

The forecolor, do you mean the color of the text (font), or the face of the button?

Comatose 290 Taboo Programmer Team Colleague

Right.

It all starts in baby steps. Every project starts in baby steps. When I first started programming, I had huge aspirations. I would take on a real huge project, and kept straying from the purpose. I'd keep coming up with new things to add to it, and wanting to change everything. Eventually, though, I learned that in order to complete a project successfully, you need to do it in steps. So, Start with making the web page. Ok, that's done. Now, build the CGI, and have the CGI save the information into a file. My personal opinion, is that due to simplicity, you could save the information that the user enters in a textfile. This will make it a little easier for the program on your computer to read the information that the CGI saved. I prefer a flat file, delimited by _:_ or Tabs, but whatever works for you.

Yes, CGI's usually start with: #!/usr/bin/perl. I go about printing the header a little different (I import CGI.pm), but, again, this is a matter of preference. If you have any questions, don't hesitate to ask.

Comatose 290 Taboo Programmer Team Colleague

well, you start by coding the CGI. If you would like... if you give me the relevant information, I can code it, or help you code it. The harder part will be coding sockets on the window side to retrieve the said information.

Comatose 290 Taboo Programmer Team Colleague

I think that what you want to do, can not be done the way you want to do it. I researched a bit on using access with a Perl CGI, and this seems semi-possible, if the server that is hosting your CGI is running their server in windows with active perl. My guess is no, they are not. They are most likely using *nix system. Now, there is a solution to this, but it is probably more work than it's worth! Let me give you the break down.

You could have your Perl CGI Accept the user data, and write it to a database on the server, then you could even have it viewable to yourself on a web page. So you surf there, Log in, and view your "sign ups". Now to answer your actual question, you could build a program to connect to your server (through a number of means... FTP, HTTP, whatever), and retrieve that data from the server. That program then saves that data in an Access Database. So, User Enter Data, Server Saves The Data, A program on your computer requests the data, and saves it to an access database. ;)

Comatose 290 Taboo Programmer Team Colleague

instead of sticking it in the body onload, have you tried calling it in the header of the page:

<HTML>
<HEAD>
<SCRIPT LANGUAGE="Javascript">
function some_function()
{

}

some_function();
</SCRIPT>
</HEAD>
<!-- The Rest Of The Page -->