vb5prgrmr 143 Posting Virtuoso

Jupiter2,

Here is a way to shorten you comman1_click code...

Image1.Visible = Not Image1.Visible

Just a piece of knowledge I thought I would pass along.

As for the OP, deftones, Jupiter2 has most of what you need to accomplish what you want but allow me to clarify more...

As of right now I cannot see a way to directly call an images click event but you can create a public sub proceedure in your form and call it...

in module...

Call Form1.MySub

In Form...

Public Sub MySub()
Call Image1_Click
End Sub

However, if you were to call a command button then you could call it directly by...

Form1.Command1.Value = True

Good Luck

vb5prgrmr 143 Posting Virtuoso

Yes it is possible by testing the C.Container.Name = "Frame1" or ...

Dim C As Control

For Each C In Me.Controls
  If C.Container.Name <> "Frame1" And C.Name <> "Frame1" Then
    C.Visible = False
  End If
Next C

As for a timer control...
If C.Name <> "Timer1" Then

But then again, you could add the timer to the frame and then not need to check to see if c.name = "timer1" within the For Each loop.

Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, in your first post you set the lock type with the second code snippet but I don't see it in the first code snippet, which means if you have not explicitly set it, it defaults back to its default settings, which might be your problem.

Now, in your second post, you have formatted the insert statement incorrectly. Presently it looks more like an update statement but that is neither here nor there or the answer to your problem. So, a properly formatted insert statement looks like this...

strSQL = "INSERT INTO tablename(Numberfieldname1, Stringfieldname2) VALUES(" & VariableContainingNumberValueForFieldName1 & ",'" & VariableContainingStringValueForFieldName2 & "')"

Good Luck

Edit: to see correctly toggle to plain text

Israelsimba commented: great help indeed..thanx +1
vb5prgrmr 143 Posting Virtuoso

First, PM a mod and have this thread moved to the .NET forum since this is the "classic vb verision 4/5/6 and not versions for versions2002/2003/2005/2008/2010.

Then, there are several ways in which to solve this. A single do while result <> "" or eight of those (one for each floor) or even a recursive call to the proceedure that collects this information.

Good Luck

vb5prgrmr 143 Posting Virtuoso
vb5prgrmr 143 Posting Virtuoso

Look at this search of MS's web site....

http://search.microsoft.com/results.aspx?form=MSHOME&mkt=en-US&setlang=en-US&q=WIA+SDK

See the second one down? When you click on that go to the bottom and go after v2.0 if you need to. The SDK has examples and if you look further down, you will see a tutorial page for WIA.

Use your friends (yahoo, google, ask, answers, bing) and search the web for vb6 wia sample as I did here...

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


Good Luck

vb5prgrmr 143 Posting Virtuoso

If you are talking about design time... then,... Drag mouse over all the controls you want to make visible = false. OR, you could put these controls in a frame, picture box, or other container control.

If at runtime..., then,... Same advice. Put the controls in a picture box and set its visiblity = false.

But then there is also this way...

Dim C As Control
For Each C In Me.Controls
  C.Visible = False
Next C

Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, the reason you are getting the index out of bounds is because of something like this...

Dim MyVar(1 to 2) As String
MyVar(0) = "Whatever" 'throws error because there is no zero (0) element
MyVar(3) = "Another error because there is not element number 3"

As for accessing an array from another proceedure, yes it is possible if you do one of two things. Either declare the array in the general declarations of the form or public in a module or pass the array in of which I see you have it declared in the general declarations section of the form. So you should be able to access the code array from within another proceedure within that same form. If however, you are accessing the code array from a module or from another form, then you will need to prefix the array variable with the form name where it is declared in...

Which means, if in form2 you want to access form1's global code array variable then you would need to do form1.code, but also don't forget to check the bounds of the array (LBound, UBound).

Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, for future reference you need to be in the .NET forum...


Now, I see where you redim preserve strNames and intLevels but no where do I see where you...

ReDim Code(LBound(strNames) To UBound(strNames)) As String

which should go between your do until loop and your for loop.

Good Luck

vb5prgrmr 143 Posting Virtuoso

Have you dimed the code variable to the same number of elements as the strNames array? Look up redim and redim preserve if needed.

Good Luck

vb5prgrmr 143 Posting Virtuoso

Just a note... VB2008 IS VB.NET...


As for unique systems...
Resellers database (Middle man sales)
Fake stock trade with all the formulas to teach people how to trade stocks and what to look for/how to read statements
MMORPG
Engineering solutions (See www.FantasticContraption.com or http://www.miniclip.com/games/magic-pen/en/ or http://bbg.bridgebuilder-game.com/ or http://www.crypticsea.com/bridgebuilding/index.html )
User defined design of system (user builds interface and database design at same time for documentation purposes for programmer to implement)

Good Luck

vb5prgrmr 143 Posting Virtuoso

Just a note here. What you are talking about is called fraud. I have flagged this thread and will leave it up to the admins to keep it open or close it. You have some splainen to do lucy (okay showing my age...)

vb5prgrmr 143 Posting Virtuoso

Let me reiterate, if you want the bat file to run in the servers process you will need to run it from the server, which means you will have to have a program on the server to shell the bat file. So, what you will need to do is to create a program that can recieve instructions from your remote program.

Search, using your friends (yahoo, google, ask, answers, bing) for winsock. There are lots of examples out there.

Once you have that down, the rest should be easy.

Good Luck

vb5prgrmr 143 Posting Virtuoso

First, you have created this thread as a code snippet asking how to do something. Second, I gave you the leads you need to solve your problem, and now third you are demanding code??? Well, I don't think so. You want code, see the WIA 2.0 SDK that you can download from MS or use your friends (yahoo, google, ask, answers, bing).

vb5prgrmr 143 Posting Virtuoso

Yes...

For readability, I try to keep my subs and functions as small as possible. So, if I can break a piece of code out and put it somewhere so I can call it, then so it is done. If there is a piece of code that I keep repeating, I try to figure out a way to make it more general so I can encapsulate it into sub or function. So, break it out, put it in a module or even within the same form if necessary but above all don't forget to document it!

Good Luck

vb5prgrmr 143 Posting Virtuoso

Use the query_unload event, set cancel to true and hide the form with me.hide or me.visible=false

Good Luck

vb5prgrmr 143 Posting Virtuoso
mainForm.StockDisplay.Caption = mainForm.StockDisplay.Caption & vbNewLine & intLevels(lngPosition)

Good Luck

vb5prgrmr 143 Posting Virtuoso

Connecting to the server is not the problem but when you do, any batch files will be run against the connecting computer and not against the server. To have the batch files run in the servers processes, you need to have the program reside on the server...

Good Luck

vb5prgrmr 143 Posting Virtuoso

What is the version of the database you are having problems with? You may have to convert it to a previous version...

Another thought. Did you add the reference to the data access object?

Good Luck

vb5prgrmr 143 Posting Virtuoso

On win2k and earlier you can use the Wang/Kodak imaging controls (image edit, image admin, etc), on xp and later you can use WIA (Window Image Acquisition). Search MS for the SDK download...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Welcome!

>Randomly getting data populated with first record information.

Please explain a little more...

Do you know how to retrieve data from database? How are you accessing this data? (ADODC, ADO, RDO, DAO ODBC Direct)

Good Luck

vb5prgrmr 143 Posting Virtuoso

Not a simple solution as you have to subclass the textbox. Please see this example...

http://vbnet.mvps.org/index.html?code/subclass/contextmenu.htm

or this that says you don't need to subclass...

http://www.devx.com/vb2themax/Tip/18376

this one uses subclassing in conjunction with a dll...

http://www.devx.com/vb2themax/Tip/18413

and not so sure about this one as it uses a timer and the OP says you cannot completly disable the popup...

http://www.a1vbcode.com/snippet-4474.asp

as this one tries to also get around it without using subclassing or the API...

http://www.a1vbcode.com/snippet-3848.asp

while this one does subclass but has a project you can download...

http://www.thescarms.com/VBasic/SubClassCtrls.aspx

same here...

http://www.vb-helper.com/howto_remove_context_menu.html

and this is the search I used to find these examples...

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

Good Luck

vb5prgrmr 143 Posting Virtuoso

So you are using the ADODC (ActiveX Data Objects Data Control) right???

adodc1.Recordset.Update

Good Luck

vb5prgrmr 143 Posting Virtuoso

and...???

You are not giving us a whole lot of information. What school book? what is your problem? Where is your problem?

vb5prgrmr 143 Posting Virtuoso

Hey V, if you look closely you will see that is the same code that I labeled as 2.) (Push)... and if you read my post that is not just one example but three...

vb5prgrmr 143 Posting Virtuoso

Several ways in which to do this and here are three...

1.) (Pass) Add a module and declare a public string variable and when user hits ok, you set the variable with the string you want. Then when the other form loads, that form retrieves the value and displays it in your label.

'module code
Option Explicit

Dim MyString As String
'------------
'form that accepts input
Option Explicit

Private Sub Command1_Click()
MyString = Text1.Text
Form2.Show
Unload Me
End Sub
'--------------
'main form that displays input
Option Explicit

Private Sub Form_Load()
Label1.Caption = MyString
End Sub

2.) (Push) From the form that recieves the input you can directly set the value of the label.

Option Explcit

Private Sub Command1_Click()
Load Form2
Form2.Label1.Caption = Text1.Text
Form2.Show
End Sub

3.) (Pull) When user clicks OK you hide the input form, show the display form and pull the information from the input form.

'input form
Option Explicit

Private Sub Command1_Click()
Me.Hide
Form2.Show
Unload Me
End Sub
'-----------------
'Display Form
Option Explicit

Private Sub Form_Load()
Label1.Caption = Form1.Text1.Text
End Sub

Good Luck

vb5prgrmr 143 Posting Virtuoso

You know what!!! If you really want someone to do this for you, then go over to rentacoder.com or odesk.com and hire someone to do it for you, else learn how to do it yourself by at least opening up the design environment and giving it a try...

jonc commented: Damn right, you tell him :P +2
vb5prgrmr 143 Posting Virtuoso

Look up the shell function...

Shell "C:\mybat.bat", vbHide

and see if it will work for you...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Then neither is try catch finally...

vb5prgrmr 143 Posting Virtuoso

Conver database to access97 and use the data form wizard, which you can find under Add-ins>Add-In Manager. I would suggest that you run the wizard for each type of form and with each type of data access and save this project for future reference.

Good Luck

vb5prgrmr 143 Posting Virtuoso

>u need think before u act

You need to know how to spell, and use correct grammer!

By the way. What were you thinking posting your question four times? Did you not think before you took action or did you just (removed by me because anything I say from here is just too mean)...

To answer your question on how to calculate 30%...

Result = Value * .3

Good Luck

jonc commented: I'm impressed by your restraint... I would have just spoken (typed) my mind :P +2
vb5prgrmr 143 Posting Virtuoso

I use the standard error handling scheme but then again I also code defensivly...

The basics for debugging are as follows...

Option Explicit

Private Sub Form_Load()

On Error GoTo Form_LoadError

Exit Sub
Form_LoadError:

MsgBox "Form_Load " & Err.Number & ":" & Err.Description

End Sub

This way I know where, #, and description while designing. Once I have finished the code and test the application and know where and what errors might occur, I adjust the code to a more defensive posture.

An example of this might be installing a dir check for a file to see if it exists before trying any type of file operation.

Then there are some errors that just cannot be accounted for like doing a recursive dir search on a hard drive from the root and the dir function coming across a *.sys file and an example on how I get around that can be found here...

http://www.tek-tips.com/viewthread.cfm?qid=1533303&tmac=fav&val=1,1533303

So, if you can see that example the code is not "do this, do that, do the other". It is more like "If I can do this then do it else try to do something else" and so on.

Good Luck

vb5prgrmr 143 Posting Virtuoso

Please stop posting the same question... I have reported this and the rest of your duplicate threads

http://www.daniweb.com/forums/thread233750.html
http://www.daniweb.com/forums/thread233757.html
http://www.daniweb.com/forums/thread233748.html

vb5prgrmr 143 Posting Virtuoso

I believe you have posted this before and now that you have actually asked for opinions, here we go.

This is not like VB.NET's Try, Catch, Finally as you explicity tell the compiler to ignore errors (On Error Resume Next or On Error GoTo 0)...

The following is VB.NET code with the proper basic Try, Catch, Finally, End Try code in a form load sub.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Try

        Catch ex As Exception
        Finally

        End Try
    End Sub
End Class

and while some may think it would be nice to have such error handling in vb6, one can achieve the same with standard vb6 error handling if one thinks about it.

Good Luck

vb5prgrmr 143 Posting Virtuoso

Which mean that the data access layer (the provider or the dll's that provide that service) are not found. You may have to download a MDAC from MS to solve this problem...

http://search.microsoft.com/results.aspx?qsc0=0&q=MDAC&mkt=en-US&FORM=QBME1&l=1

Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, we can see what your homework requirements are but what we cannot see is which part you are having a problem with. Where is your question on what part of that you are having a problem with?

Good Luck

vb5prgrmr 143 Posting Virtuoso

Celt.Max,
the code you are using is for the VBA Listbox control found in Excel, access, etc. and while it is usable from VB6, it is not redistributable...

IvanKenny,
There are two ways in which to accomplish what you want...
1.) Use a listview control.
2.) Do a bit of subclassing on the listbox. See... http://www.thescarms.com/vbasic/listbox.aspx

Good Luck

ivankenny commented: get it solve my problem thx for the tip i used method 2 +0
vb5prgrmr 143 Posting Virtuoso

Time to use your friends (yahoo, google, ask, answers, bing) and search for...

vb6 run at startup
vb6 GetAsyncKeyState

Good Luck

vb5prgrmr 143 Posting Virtuoso

Lida_Pink,

Lets make sure of our definitions first... The sum of numbers is, those numbers being added together, while the product of numbers is, those numbers being multiplied together. So if you want the sum of numbers in a string then celt.max's code does work...

Option Explicit

Private Sub Form_Load()
Dim Result As Integer
Result = SUM("1234")
MsgBox Result
End Sub

Public Function SUM(sNumber As String) As Integer
Dim iX As Integer, iCount As Integer
     For iX = 1 To Len(sNumber)
          iCount = iCount + CInt(Mid(sNumber, iX, 1))
     Next iX
     SUM = iCount
End Function

However, if you are wanting the product of the numbers, then yes a different solution is needed. So, are you wanting the product of these numbers?

Good Luck

vb5prgrmr 143 Posting Virtuoso

None Case Sensitive

Option Explicit
Option Compare Text

Private Sub Form_Load()
Dim S As String
S = "This is a test"
If Left(S, 1) = Right(S, 1) Then MsgBox Left(S, 1) & " matches"
End Sub

For case sensitive remove the option compare text....

Good Luck

vb5prgrmr 143 Posting Virtuoso

Plz, Correct my Code:

RS.Find "'" & Text1.Text & "'='" & Text2.Text & "'"

Good Luck

vb5prgrmr 143 Posting Virtuoso

Please stop using SMS code it makes your post hard to decipher...

First, create an access97 mdb or your sql database. Then use the data form wizard to create the base code for you.

Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, let first start by reminding you of code tags...

Then let me say where are you getting this error? What line and what are the state of your variables?

Next up is how do you add, i.e. the use of addition, two string together? (Sarcastic, yes, I know). But in reality you concatinate two string together by the use of the ampersand character (&)...

String1 = String1 & String2

Another thing I noticed is in the first case you have "\path" but in the second and thereafter cases you have "\path\"

Public Sub CreateDir()
Drv = App.Path
If Right(Drv, 1) = "\" Then Drv = Left(Drv, Len(Drv) - 1) 'chop off any trailing back slash as you have seemed to include it below in your code so as to avoid a double backslash in the path "\\"
ChDir Drv
Select Case intRegg
Case 1 
  Flow = Drv [b]&[/b] "\CHXPLUS1"
Case 2
  Flow = Drv [b]&[/b] "\CHXPLUS2"
Case 3
  Flow = Drv [b]&[/b] "\CHXPLUS3"
Case 4
  Flow = Drv [b]&[/b] "\CHXPLUS4"
Case 5
  Flow = Drv [b]&[/b] "\CHXPLUS5"
Case 6
  Flow = Drv [b]&[/b] "\CHXPLUS6"
End Select
MkDir Flow
WriteFiles 1, 1, 0
Back2_3 4
End Sub

Also, I removed all of your mkdir statements since the select case is only used to build the path and put the mkdir statement after the select case to shorten your code.

Then I removed your case else as you had no code there so no need …

vb5prgrmr 143 Posting Virtuoso

Please reread my post above...

vb5prgrmr 143 Posting Virtuoso

Using the common dialog control with the flag of defaultprinter=true is one way. The other is the API...

http://vbnet.mvps.org/index.html?code/system/defaultprinter.htm

http://www.tek-tips.com/faqs.cfm?fid=5479

However, the API seems a bit outdated but checking with MS...

http://support.microsoft.com/kb/266767
http://support.microsoft.com/kb/246772/EN-US/

With Windows NT 4.0 (and earlier versions), you cannot use:
Either SetPrinter or SetDefaultPrinter to set the default printer.
Either EnumPrinters or GetDefaultPrinter to get the default printer.
With Windows NT 4.0, you can use:
GetProfileString to get the default printer.
WriteProfileString to set the default printer.

So, you will need to check for the os to see if it is NT or earlier or Win2k or later to see which set of API's to use.

Good Luck

vb5prgrmr 143 Posting Virtuoso

OldQ, for future reference you are using .NET code and are presently in the wrong forum. You need to post your Q's in the .NET forum...

In vb6 there are two different ways to accomplish what you want. One is setfocus and the other is zorder.

Good Luck

vb5prgrmr 143 Posting Virtuoso

Time to use your friends (yahoo, google, ask, answers, bing) and/or http://www.planet-source-code.com as there is code out there already...

Good Luck

PS. Please in the future do not hijack or resurrect older threads. Post your own.

vb5prgrmr 143 Posting Virtuoso

Simple search from one of your friends (yahoo, google, ask, answers, bing) would provide you some information...

http://search.yahoo.com/search?p=vb6+multiple+instances+of+activex&toggle=1&cop=mss&ei=UTF-8&fr=yfp-t-701

Good Luck

vb5prgrmr 143 Posting Virtuoso

Lets not forget the new speech recognition technology...

http://search.microsoft.com/results.aspx?form=MSHOME&mkt=en-US&setlang=en-US&q=voice+to+text+command

Good Luck

vb5prgrmr 143 Posting Virtuoso

Hit CTRL+Break and see where the error is if this is your program you are talking about...

Good Luck