vb5prgrmr 143 Posting Virtuoso

I saw an example somewhere on the web, don't remember where but they used a combo box. So search (google/yahoo) for...

Nevermind I searched and got these results...

http://search.yahoo.com/search?p=vb6+-net+grid+combo&fr=yfp-t-152&toggle=1&cop=mss&ei=UTF-8

Good Luck

vb5prgrmr 143 Posting Virtuoso

Hit CTRL+Break and see which/where code is highlighted. Do you have Option Explicit (Require Variable Declaration) turned on?

Good Luck

vb5prgrmr 143 Posting Virtuoso

Please reread my post carefully....

The answers are in there

vb5prgrmr 143 Posting Virtuoso

So you are talking about checking over the internet. You will need to create a seperate exe to (these are searchable terms (google/yahoo))...

1.)Check Internet Connection
2.)URLDownLoadToFile
3.)Open statement, Line Input Function, Close Statement, FreeFile Function
4.)ShellExecute

So the suggested process would be to...
1.)Check the internet connection to see if it is active
2.)If active then download text file that has the information to the latest exe version
3.)Open, Read, Close text file and check to see if current running exe is the same version or not.
4.)If not, launch secondary.exe to download new exe and end primary.exe
5.)Secondary.exe launches, waits a couple of seconds for primary.exe to end and then uses URLDownloadToFile to copy exe from http source to local drive.
6.)Secondary.exe then uses shell or shellexecute to launch primary.exe
7.)Secondary.exe ends


NOTE: This version will only work if you do not add dependancies between versions. If you do then you will need to download a new setup package and use that to install a new version.


Good Luck

vb5prgrmr 143 Posting Virtuoso

What ever b8controls is but I have never heard of it before...


Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, for demo purposes only, start a new project, add a label(Label1) and make it large enough to hold the question. Add an option button (Option1), set its index to zero(0), visable=false, Add a command button (command1).

Option Explicit
Dim QandA(1 to 20) As String
Dim HowManyAnswers As Integer
Dim CurrentQuestion As Integer

Private Sub Form_Load()
QandA(1) = "What Is Your Name?, Billy Martin, Sam Jones, Billy Bob Thorton, George Johns, Bob Smith"
QandA(2) = "What is your age?, 10, 15, 20"
'...
CurrentQuestion = 1
Call DisplayQuestion
End Sub

Private Sub DisplayQuestion()
Dim MyArray As String, ForLoopCounter As Integer
MyArray = Split(QandA(CurrentQuestion), ",")
Label1.Caption = MyArray(0)
If HowManyAnswers > 0 Then
  For ForLoopCounter = 1 To HowManyAnswers
    Unload Option1(ForLoopCounter)
  Next ForLoopCounter
End If
For ForLoopCounter = 1 To UBound(MyArray)
  Load Option1(ForLoopCounter)
  Option1(ForLoopCounter).Caption = MyArray(ForLoopCounter)
  Option1(ForLoopCounter).Top = Option1(ForLoopCounter - 1). Top + Option1(ForLoopCounter).Height + 30
  Option1(ForLoopCounter).Visible = True
Next ForLoopCounter
HowManyAnswers = UBound(MyArray)
End Sub

Private Sub Command1_Click()
CurrentQuestion = CurrentQuestion +1
Call DisplayQuestion
End Sub

Granted, this is just a demo of one way you could do it and also note that you would have to figure out how to keep track of which answer is correct and so on.


Good Luck

vb5prgrmr 143 Posting Virtuoso

Then see my post above, remove the single ticks from around the fields that are numbers and use Trim, val, cint etc. to make sure the values from the boxes are not preceeded or trailed by spaces.


Good Luck

vb5prgrmr 143 Posting Virtuoso

You cannot "add" strings together (+), you can however concatinate strings together (&). As for everything else, it looks fine at first glance.


Good Luck

vb5prgrmr 143 Posting Virtuoso

Most barcode readers are very simple to intergrate into vb programs.

Start new project, add a text box to the form, and run the project (or just start notepad).
Scan something (if using project make sure text box has focus).

Good Luck

vb5prgrmr 143 Posting Virtuoso

Glad I could help, if you don't mind, could you please mark this thread as solved.


Thanks and Good Luck

vb5prgrmr 143 Posting Virtuoso

Well it looks like you have lost reference to a custom control. Did this project come from another computer? If so you need to instal/register the missing control/dll on this new computer.

If not, and you have the controls installed correctly on this computer then find the controls (which should now be picture boxes), delete them, and replace them on the forms.

Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, so questions with possible answers are coming from a database/text file/some source right? You only need one form with a label to display the question. Then if it is multiple choice, meaning that user would select one or more answers, then use a hidden check box for that question or if answer is only one possible right answer use a hidden option button.

Now with the hidden controls (optionbutton or checkbox) use the load method and the caption property to load new controls and display the answers, which means you will have to set the index of these hidden controls to zero (0).


Good Luck

vb5prgrmr 143 Posting Virtuoso

Google and yahoo are your freinds as is www.pscode.com. There are many snippits out there that does this.

Good Luck

vb5prgrmr 143 Posting Virtuoso

You don't, you need to either use LoadResData or LoadResString to extract the information from a resource file and then use split to put that information into an array to add it to your combobox or save it to a file to use your code.

Good Luck

vb5prgrmr 143 Posting Virtuoso

So then you are wanting to use the text as the foreign key?

StringValue = List1.List(List1.ListIndex)


Good Luck

vb5prgrmr 143 Posting Virtuoso

Still a little unsure of what/why you are doing what you are doing so please explain further.

Perhaps a little more information on your table structure and exactly why you want the text versus the value.


Good Luck

vb5prgrmr 143 Posting Virtuoso

Combo1.Text
Option1.Caption


Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, in the click event of your command button that closes the form or in form_unload you need to close all your objects and set them to nothing...

Rs.Close
Set Rs = Nothing

and that goes for your command objects, parameter objects, recordsets, connections, and so on for everything that you have declared within this form.


Good Luck

vb5prgrmr 143 Posting Virtuoso

Without seeing your code it is hard to guess what exactly is going on but from the sounds of it, you have not fully unloaded the form when you try and show it again.


Good Luck

vb5prgrmr 143 Posting Virtuoso

Use the Line Input function instead of the input function. Line Input will read the entire line.


Good Luck

vb5prgrmr 143 Posting Virtuoso

For an example, use the data form wizard. You will find this very useful wizard under Add-ins and if you don't see it, click on Add-In Manager. Use the code option.


Good Luck

vb5prgrmr 143 Posting Virtuoso

Read up on the Dir Function in VB's help. There is also a usable example.


Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, if strings you are missing the single ticks...

"UPDATE Class_Nursery SET Subj1 = [B]'[/B]" & txtSbj1.Text & "[B]'[/B] WHERE Status = 'Continue' AND Session = [B]'[/B]" & txtSession.Text & "[B]'[/B] AND Section = [B]'[/B]" & cmbSection.Txt & "[B]'[/B]"

As for updating multiple fields you have already posted the code...

SET Field1 = value1, Field2 = value2, ...

Good Luck

vb5prgrmr 143 Posting Virtuoso
vb5prgrmr 143 Posting Virtuoso

Read up on creating controls, activex exe's, and dll's.

Good Luck

vb5prgrmr 143 Posting Virtuoso

Do you know how to use ADO, DAO, RDO? Do you know what a select query is? Have you ever heard of the Data Form Wizard?

You have left al lot of information out of your request like...

Database type (Access, MySQL, SQL, Progress, Alpha5, FoxPro, dBase, Text Files, Oracle, and so on)

Database Structure (Table(s) name, Field name(s))


Good Luck

vb5prgrmr 143 Posting Virtuoso

You can't.

vb5prgrmr 143 Posting Virtuoso

Update.... where somefield=somevalue

You are missing the where statement and as such are setting everyrow to same value.

Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, you will need two arrays then. First array will mirror exactly what is in List1...

List1.AddItem "Place1"
Array1(0) = "Place1"
List1.AddItem "Place2"
Array1(1) = "Place2"

Second array will be a two dimensional array.

Dim Array2(0 To NumberOfCountries, 0 To MaxNumberOfPlaces) As String

So in list1 click event you could use a for loop to populate list2.

Dim I as Integer
For I = 0 To MaxNumberOfPlaces
  If Trim(Array2(List1.ListIndex, I)) <> "" Then
    List2.AddItem Array2(List1.ListIndex, I)
  End If
Next I

Good Luck

vb5prgrmr 143 Posting Virtuoso

To add items to a listbox use the .AddItem method. Now from the sounds of this you will also need to use the .Clear method on List2 before you populate it with places.

Now, how are you going to hold all of this information? Text File, database, code, ini file, other?

Once we know that, then we will be able to help you with the logic of the code and other things you may need.

Good Luck

vb5prgrmr 143 Posting Virtuoso

Because you don't have them in upper case. You have them in Propercase (Four, Five, Six). If you want them in all caps then use the UCase function or change your code. Also, if you set a breakpoint in TxtPaymentInWords_KeyPress, you will find out that when you go TxtPaymentInWords.Text = "string", the keypress event is not called because no keypress event happened, you just changed the text of the textbox.

Good Luck

vb5prgrmr 143 Posting Virtuoso

Easier if you add the items to two comboboxes, add a command button to add the values from each combobox together to output to your text box. Otherwise you are going to have to keep track of what is selected and this will cause you more code and headachs.

Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, to split on the comma (,) you need to use...

THE Split Function!

Dim MyArray() As String
MyArray = Split(lstData.List(i), ",")
txtID.Text = MyArray(0)
txtName.Text = MyArray(1)
txtAge.Text = MyArray(2)

Then would it not be lstData.RemoveItem(i)?

And now for why you are having so many problems...

Tools>Options>Put a check next to Require Variable Declaration>OK

In future projects this will put Option Explicit at the top of all your forms and modules and will make you declare your variables. This will solve a lot of problems for you. In fact, you could manually put it in at the top of your existing forms and modules and this will help you out by pointing out your mistakes.


Good Luck

vb5prgrmr 143 Posting Virtuoso

Google/yahoo are your friends...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Time to delve into the API...

FindWindow and SetParent should do the trick for you...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Yeah, that is one of the unfortuanate things about the command button is that they did not expose the fontcolor or forecolor for the control, but you can get around this (as mentioned above) by setting the style property to graphical at design time. Then you could use a picture box of the appropriate size with autoredraw set to true. Set its forecolor to the color you want then use Picture1.Print "Your Caption". After that set command1.picture = picture1.image. However, to get it to look right, you will have to set the currentx and currenty properties of the picture box before you print your caption.


Good Luck

vb5prgrmr 143 Posting Virtuoso
Dim comSave As New ADODB.Command
[B]Set[/B] comSave.Activeconnection = connDB

Good Luck

vb5prgrmr 143 Posting Virtuoso

After that, you will need to use the Package and Deployment Wizard to distribute your application or you can use Inno.


Good Luck

vb5prgrmr 143 Posting Virtuoso

Either, if from vb use the command object to execute it.

As for crystal reports, yes you will need to install it. if you have pro or enterprise you should find on the disk a folder named crystal, inside is the installable. Run it and you will have crystal reports 4.5.


Good Luck

vb5prgrmr 143 Posting Virtuoso

A couple of ways...

... = Trim(AfsugRS(j - 1))

... = AfsugRS(j - 1) & vbNullString

Or you could try an update statement...

strSQL = "UPDATE Table1 SET Field1 = " & vbNullString & " Where Field1 = " & vbNull

(or something like that as I don't remember the last time I had to do it... it could be...)

strSQL = "UPDATE Table1 SET Field1 = " & vbNullString & " Where Field1 = Null"


Good Luck

vb5prgrmr 143 Posting Virtuoso

UNC Path

\\servername\sharename\filename

Private Sub MySub(FileToRead As String)

On Error GoTo MySubError

Dim FName As String, FNumb As Integer

'first check to see if local file exists and if so kill it
If Dir(App.Path & "\temp.txt") <> "" then Kill App.Path & "\temp.txt"

'save network resources and other problems that may arise from opening a file across the network by copying the file locally
CopyFile FileToRead, App.Path & "\temp.txt"

FName = App.Path & "\temp.txt"
FNumb = FreeFile

Open FName For Input As #FNumb
Do While Not EOF(#FNumb)
  '....
Loop

Close #FNumb

Kill FName

Exit Sub
MySubError:

'error handler here

End Sub

Or something like that...


Good Luck

vb5prgrmr 143 Posting Virtuoso

There are several technologies available to use to send email with vb6 and if you search the web you will find many examples like this search...


http://search.yahoo.com/search?p=vb6+email&fr=yfp-t-152&toggle=1&cop=mss&ei=UTF-8


Good Luck

vb5prgrmr 143 Posting Virtuoso

The code that you show needs to be within a procedure. Either a sub or function like form load, it cannot be in the general declarations section of a form or module.


Good Luck

vb5prgrmr 143 Posting Virtuoso

You would need a service running on each server and you would have to call the service to feed you the text file. Or you can use the UNC path for each server to where the file is but you will have to have permissions to access the folder and file.


Good Luck

vb5prgrmr 143 Posting Virtuoso

From VB's help files...

Project Limitations

A single project can contain up to 32,000 "identifiers" (any nonreserved keyword), which include, but are not limited to, forms, controls, modules, variables, constants, procedures, functions, and objects. Note that the actual number of identifiers is limited to available memory

You can however get around the limitations at least the part of the controls by using control arrays as the limitation speaks directly to the identifier (label1, label2,...) but Label1(0), Label1(1), ... is only one identifier.


Good Luck

vb5prgrmr 143 Posting Virtuoso

UPDATE Table1 SET Field2=Table1.Field2-1 WHERE Field1=Value

Where Field1 = unique value to identify record and Field2 = the value you want to decrement by 1

As for creating an invoice there are several ways. Datareport, Crystal Report, or one of your own design via the Printer object. But to be able to do this you will need a purchase table to record the items purchased with some unique ID that ID's the customer so when you go to print the reciept, the table can be queried against.


Good Luck

vb5prgrmr 143 Posting Virtuoso

Without your code it is hard to tell...

vb5prgrmr 143 Posting Virtuoso

It has been a long time since I used CR, but if I remember correctly, you can set the sql statement of the CR so that only the records you want are queried for, thus making it faster.


Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay,...

You are trying to do two unrelated things with one query statement... and your query structure is incorrect...

This would be correct...

Statement = "SELECT * FROM tblAsset WHERE AssetID = " & txtAssetID.Text

if a number field is what you are querying against...

Now as for the rest of the statement you are trying to execute...

First, quick SQL lesson...

SELECT * FROM tablename WHERE field1 = value AND field2 = value

so your query structure...

...txtAssetID.Text & " picProduct.Picture = ...

is incorrectly formated.

Now, if you debug.print picProduct.Picture with no picture you should recieve 0 in return but if picProduct.Picture does have a picture then you will get a numerical representation...

So, to make a long read shorter, use the query as above, execute it, and then retrieve its values and from what I can guess the PictureFileName is a field name so...

Statement = "SELECT * FROM tblAsset WHERE AssetID = " & txtAssetID.Text
RS.Open Statement, ConnDB, adOpenForwardOnly, adLockReadOnly, adCmdText
picProduct.Picture = LoadPicture(app.path & "\" & RS.Fields("PictureFileName"))
RS.Close


Good Luck

vb5prgrmr 143 Posting Virtuoso

Yes, a module with public declared variables would be the easiest bet. Then in form load open the database and in form unload close the database.


Good Luck