vb5prgrmr 143 Posting Virtuoso

Putting a picture into memory or into a picture box is quite easy with the LoadPicture function. Reading each pixel is also easy, if not slow, by using the point method, which returns a long value that you can then break up into the RGB triplet by using some simple math. On the other hand you could speed the reading of each pixel up by using the GetPixel API.

Once you get started on some code, if you have any problems come back and post the relevant code. We will be more than happy to help...

Good Luck

vb5prgrmr 143 Posting Virtuoso

I thought that might be the problem. Glad you got it solved. Now, if you don't mind could you please mark this thread resolved.

Thanks and Good Luck

vb5prgrmr 143 Posting Virtuoso

Place a breakpoint at the line and hover the mouse over the variable. Do you see if you actually have a full path and file name in the variable? Or goto the immediate window and type in ?gf_strDbPath and hit enter. Does the variable contain a fully qualified path and file name?

Good Luck

vb5prgrmr 143 Posting Virtuoso

You can't! At least not with Visual Basic. You can however with RealBasic...

Good Luck

vb5prgrmr 143 Posting Virtuoso

3 Okay, the MDAC is the Microsoft Data Access Components and yes you need it.
2 Those 3 are one in the same...
1 Yes, as previously stated you need those three files...

Tell users to right click on setup.exe and run as admin or download Windows Installer 1.1 from microsoft or check out the Inno setup for vb 6.0 as these are both free.

Good Luck

pankaj.garg commented: thanks for the inputs +1
vb5prgrmr 143 Posting Virtuoso

Okay, there are three files you need to distribute you application. The Cab, the lst, and the exe. (You did create a standandard deployment package, didn't you?) The support directory you do not need to include in your zip, if that is how you are putting you application on the web.

Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, I don't know what kind of code you have in the resize event but here goes...

Option Explicit

Dim BusyResizing As Boolean

Private Sub Form_Resize()
If Me.WindowState = vbMinimized Then Exit Sub
If BusyResizing = True Then Exit Sub 'this prevents reentrancy while user is dragging edge of form
BusyResizing = True
Timer1.Interval = 250 '1/4 second
Timer1.Enabled = False
'do resizing code here
BusyResizing = False
Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
Timer1.Enabled = False
GridName.forcecolfit
End Sub

Okay, the logic behind the above is this. The boolean variable keeps the resize event from being entered or reentered (reentrancy) as the user drags the edge of the form. Controlling the timer this way in the hopes that the timer event will only fire after the user has released the edge of the form...

Note: Untested suggestion above

Good Luck

vb5prgrmr 143 Posting Virtuoso

I would check for an interval delay or use a boolean value to prevent the called sub/function from being called repeatedly, or perhaps a timer control would do...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Add a module, and add...

Sub Main()

End Sub

Then add the code you need to inside of sub main but don't forget to put in your Form1.Show or your program will look like it does not even run. Next, GoTo Project>Properties and on the right there is a combo box right under the words "Startup Object:". Select Sub Main and hit OK.

Good Luck

pankaj.garg commented: thanks...this helped.. +1
vb5prgrmr 143 Posting Virtuoso

In module...

Public Const MyVar As Integer = 5

However, you will not be able to change this value if you are wanting to have this value change.

Now, there is another way if you have your program start up in a sub main...

Option Explicit

Public MyValue As Integer

Sub Main()
MyValue = 5
Form1.Show
End Sub

Good Luck

vb5prgrmr 143 Posting Virtuoso

something like...

If j Mod 42 = 0 Then Me.cls
Print ...

This will clear the form of the printing you have done to it and reset the currentx and currenty properties to 0. Look it up in help to make sure you use it right if you are manipulating the forms autoredraw property.

Good Luck

vb5prgrmr 143 Posting Virtuoso

Well since OP does not have the source, the OP cannot check references, and I'm betting that the "Error Creating Letter: Cannot Create Object" is our best clue as to what might be going on. I'll also bet that the system is missing some third party software like Adobe, or Office because of the "Letter" part.

Good Luck

vb5prgrmr 143 Posting Virtuoso

To begin with, let me reiterate that just because you put a file in the support folder does not mean it will be included with your setup package! You have to manually add the file when creating your setup package and when you do so you have to specify exactly where you want it to be installed! Then if you have hard coded your path to where this file is located in your code and the file is not installed in that exact same place...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Either rewrite as an ASP application or convert it to activex.

Good Luck

vb5prgrmr 143 Posting Virtuoso

Capture start time into a variable and use datediff function to test the difference returning seconds mod 60 returns minutes mod 60 returns hours. Understand?

Good Luck

vb5prgrmr 143 Posting Virtuoso

And??? I'm still not understanding but good luck anyways...

vb5prgrmr 143 Posting Virtuoso

What do you think I pointed you to with that search and suggested sites?

vb5prgrmr 143 Posting Virtuoso

Are you using the PDW? (Package and Deployment Wizard) If so, when you are walking through the steps, there is a screen that allows you to add files (Files are not added automatically when you put them in the support directory, you have to add them.). Use this screen to add the database and to specify where it is to be installed.

Good Luck

vb5prgrmr 143 Posting Virtuoso

Where did you tell your setup package to install your database? Because I believe the path you used to point to your database is incorrect and hence the error you are recieveing...

Good Luck

vb5prgrmr 143 Posting Virtuoso

In form1 create a public sub so when you hide form2 you can call it...

Form1.MyPublicSub
Me.Hide

then in the form1's mypublicsub you instruct whatever data access method you are using to refresh/requery itself and to redisplay the information.

Good Luck

pankaj.garg commented: thanks... +0
vb5prgrmr 143 Posting Virtuoso

Not quite sure what you are asking but I do know you will need to use ExtractIconEx. Now, in these search results ...

http://search.yahoo.com/search?fr=yfp-t-701-s&toggle=1&cop=mss&ei=UTF8&rd=r2&p=vb6%20extracticonex

I would suggest that you have a look at vbAccelerator, theScarams, and vbnet.mvps.org examples. One of them should lead you into the right direction...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Why not just use the DriveListBox???

vb5prgrmr 143 Posting Virtuoso

by use of the rnd function (see help) and the randomize statement in your startup object.

Good Luck

vb5prgrmr 143 Posting Virtuoso

Don't think so but look at Project>References. You should have these four at the top and in this order...

Visual Basic For Applications
Visual Basic runtime objects and procedures
Visual Basic objects and procedures
OLE Automation

Okay, so you are wanting to create an access database and not just open one (as what your code is saying...)

Okay, see post #12 in this thread for an example... http://www.codeguru.com/forum/showthread.php?t=476345

or since you are using DAO start a new project and add the 2.5/3.51 compatability library and then type in...

Dim DB As DAO.Database
Set DB = DBEngine.CreateDatabase

and with the cursor somewhere in or at the end of createdatabase press F1 to bring up help.

Good Luck

pankaj.garg commented: Thanks...this helped +0
vb5prgrmr 143 Posting Virtuoso

Well first off you need to make sure the directory exists by using the dir function and if it does not exist then you need to use the mkdir statement. HOWEVER, if you are on vista or win7 and in the program files directory, you will not be able to use app.path. Instead, use environ("appdata") & "\ProgramName\Data\nameofmdb.mdb.

Good Luck

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

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

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

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

adodc1.Recordset.Update

Good Luck

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

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

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

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

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

As for tutorials for either vb6 or any of the flavors of vb.net, you can use your friends (yahoo, google, ask, answers, bing) to find them. So you keywords would be vb6 read write consol.

Then in this thread, is just a small sample of sites I have collected up to that point that have code, tips, tricks, and tutorials...

http://www.daniweb.com/forums/thread214396.html

Good Luck

vb5prgrmr 143 Posting Virtuoso

VB's IDE Menu>Project>Add Module

Good Luck

vb5prgrmr 143 Posting Virtuoso
If Val(Text1.Text) < 0 Then
  Text1.Text = "-" & Text1.Text
Else
  '...

Good Luck

vb5prgrmr 143 Posting Virtuoso

But that was not what the OP was asking there elkhartlynn...

vb5prgrmr 143 Posting Virtuoso

rs.addnew
rs.fields("somefield") = somevalue
rs.update

Good Luck

vb5prgrmr 143 Posting Virtuoso

Don't know what to tell you abu, your original problem "form2.show" being highlighted was more than likely because form2 did not exist. Look in the object window (Project window) on the right and see what you have named your forms. Do you have a form or forms showing like this... formTest(Form1)... if so, the name within the parenthesis () is the file name and the name before the parens is the name you should use in code.

Good Luck

vb5prgrmr 143 Posting Virtuoso

:-) Don't feel bad. I'm ashamed myself that I could not remember the read command from QB but hey that is the way things go.

Okay, is this data static? Never changes? Then in a bas module this might be the easiest...

Option Explicit
Public Org(1 to 5, 1 to 4) As String 'integer, long, double...

Public Sub InitializeOrgArray()
Org(1, 1) = "Some value"
Org(1, 2) = "Some Value"
'...
Org(2, 1) = "Some Value"
'...
Org(5, 4) = "Some Value"
End Sub

However, if this data is not static... Then how do you plan on getting the data?

Good Luck