SCBWV 71 Junior Poster

Use RichTextBoxName.SaveFile(pathname) and RichTextBox.LoadFile pathname. The default file format is RTF.

SCBWV 71 Junior Poster

Use the StrConv function:

Text1.Text = StrConv(Text1.Text, vbProperCase)

vbProperCase converts the first letter of every word in string to uppercase.

Other constants are vbUpperCase, vbLowerCase, vbUnicode, and vbFromUnicode.

SCBWV 71 Junior Poster

Checkboxes can also be set programmatically - ListView1.Checkboxes = True/False

SCBWV 71 Junior Poster

I thought I had posted to this question, but its not showing up, so I'll post again at the risk of repeating. Here's a link to code using the Windows API call and code using the built-in Visual Basic functions.

http://support.microsoft.com/kb/185476

SCBWV 71 Junior Poster

Efficient search routine using Windows API or built-in Visual Basic functions - http://support.microsoft.com/kb/185476

SCBWV 71 Junior Poster
SCBWV 71 Junior Poster

For the Printer object setting the height and width set at run time, values are used instead of the setting of the PaperSize property. Height and width are for the Printer object are always specified in twips with 1440 twips per inch. So a 6 inch height = 8640 twips; a 10 inch width = 14,400. Your height setting is less than half an inch.

"If you set the Height and Width properties for a printer driver that doesn't allow these properties to be set, no error occurs and the size of the paper remains as it was. If you set Height and Width for a printer driver that allows only certain values to be specified, no error occurs and the property is set to whatever the driver allows. For example, you could set Height to 150 and the driver would set it to 144."

You may find i easier tp use one of the standard PageSize constants here http://msdn.microsoft.com/en-us/library/aa245867(VS.60).aspx

SCBWV 71 Junior Poster

DateDiff("d", "01/01/2008", "01/01/2010")

Reference - http://msdn.microsoft.com/en-us/library/aa262712(VS.60).aspx

SCBWV 71 Junior Poster

If the printer provides a serial port interface, it may be easier to use that. If you must use the USB interface, this may help. http://www.intel.com/intelpress/usb/examples/VBOverview.htm

SCBWV 71 Junior Poster

That's because by the time Text2.Text = Text1.Text executes, Text1.Text has already been changed. Try:

Dim Txt as String
Txt = Text1.Text
Text1.Text = Text2.Text
Text2.Text = Txt

SCBWV 71 Junior Poster
SCBWV 71 Junior Poster

Do you mean a line that goes around the edge of the form, like a border? If so, you can Shape control, and redraw the Shape's dimensions in the Form_Resize event.

As an example, create a Shape on the form with a Top and Left of 60. Then add

Shape1.Height = Me.ScaleHeight - 120
Shape1.Width = Me.ScaleWidth - 120

to the Form_Resize subroutine. This resizes the Shape when the form is resized by the user.

SCBWV 71 Junior Poster

Use a Label in front of each text box and in the Caption for the Label, use an & in front of the letter to define the shortcut key - &m in your example. Make sure the Label's TabIndex is one less than the TabIndex for its associated TexBox. That should do it.

SCBWV 71 Junior Poster

Post your declarations here so we can see what you're doing.

SCBWV 71 Junior Poster

Go to the Project menu and select Add Module. Open a New module and you will see it in the list (Module1).

SCBWV 71 Junior Poster

I put all my global declarations, constants and defined types in a module.

SCBWV 71 Junior Poster

Why not use a public boolean value as a toggle?

SelectedAll = NOT SelectedAll
Item.Checked = SelectedAll

Then the function can select and deselect all depending on the last state.

SCBWV 71 Junior Poster

Probably the easiest way to do what you want is to use a Browser control on your form and open the PDF file in the browser - Browser1.Navigate PDFFile$ - works like a charm and you're not tied to a particular version of Acrobat Reader.

SCBWV 71 Junior Poster

The maximum number of controls on a form depends on the type of control and the available system resources. There is a strict limit of 254 control names per form. However, you can use control arrays or user controls to go beyond 254 controls.

Check this:
http://support.microsoft.com/kb/229756

SCBWV 71 Junior Poster

There is no caption in the label to retrieve.

Comatose commented: Good Response! +10
SCBWV 71 Junior Poster

Hi Jaasaria:

Try:
Call LockWindowUpdate(frmPOS.ListView2.hwnd)
userPriceList1
Call LockWindowUpdate(0&)

SCBWV 71 Junior Poster

You can also try LockWindowUpdate to prevent the ListView from updating while the records are loaded.

Private Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As Long) As Long

Call LockWindowUpdate (ListView1.hwnd)
'load the records
Call LockWindowUpdate (0&)

SCBWV 71 Junior Poster
SCBWV 71 Junior Poster

I'm not sure why you're using a timer, but you can format time in 12 or 24 hour formats with the Format function - Format(Time$, "hh:mm:ss") or Format(Time$, "hh:mm:ss AMPM")

SCBWV 71 Junior Poster

If you know the PPS file ahead of time, you can embed them in the VB application as an insertable object. However, I don't see where PowerPoint lets you programmatically assign the file in VB.

As an alternative, you could shell out to PowerPoint then close it with your program. Check out this link. http://www.thescarms.com/vbasic/StopProcess.aspx

SCBWV 71 Junior Poster

Create two Image control arrays. Then use a loop to load each picture as shown below

JPegPath$ = "C:\My Pictures\"
PicFile$ = Dir$(JPegPath$ & "*.jpg")
Inx = 1
Do While LenB(PicFile$) > 0
   Load Image1(Inx)
   Load Image2(Inx)
   Image1(Inx).Visible = True 
   Image2(Inx).Visible = True
   Image1(Inx).Picture = LoadPicture(JPegPath$ & PicFile$)
   Image2(Inx).Picture = LoadPicture(JPegPath$ & PicFile$)
   Inx = Inx + 1
   PicFile$ = Dir$
Loop
SCBWV 71 Junior Poster

Use a for/next loop to load the images from disk. If the number of images loaded is not evenly divisible by 2, you have a problem, since you can't match up an odd number of images. Use 2 image control arrays. Inside the loop, as each image file is read, load the same file in both image arrays, thus creating matched pairs. If you do it this way, it will be easy to tell if the user selects a match because each matched pair will have the same index number. For example Image1(1) will have the same picture as Image2(1), Image1(2) will have the same picture as Image2(2), and so on. You'll need code to randomly arrange the two image arrays on the screen.

SCBWV 71 Junior Poster

You could use the Split funtion, but that wouldn't work well if your string contains more than one space, for example "white bread 0.67" If the price is always the last part of the string, why not create a function that starts at the end and finds the last space?

SCBWV 71 Junior Poster

You have to use a richtextbox, but that only supports a subset of rtf, so you won't get full support of the rtf codes from Word. I have successfully brought in tables, even with borders, but the richtextbox won't maintain the integrity like Word does. Worse yet, in my experience, the behavior of the richtextbox varies with operating system versions.

SCBWV 71 Junior Poster

Try the .Children property

SCBWV 71 Junior Poster

Why can't you just put centering code in the Form_Load event of the mdi child form? You know what window will be the parent, and it wouldn't matter is the parent is maximized or normal.

SCBWV 71 Junior Poster

You could use the multiple-document interface (MDI) in which the forms are a "child" of the "parent" main form, but MDI program can be a pain. Why can't you just use the main form's properties to decide where the other forms should appear? For example, in the Form_Load event of Checkout...

Top = Form1.Top 'add any offset you want
Left = Form1.Left 'again add the desired offset

SCBWV 71 Junior Poster

Error '3077' Syntex error (missing operator) in expression

Try Data1.recordset.FindFirst ("nhisto = " & answer)

SCBWV 71 Junior Poster

To some degree you can manipulate the msgbox, but if you haven't noticed, new message boxes in Vista and subsequently, Windows 7, have a nice look you can't get in classic VB without making your own - such as the high resolution icons. By making your own message box, you can support the higher resolution icons in an image control and give your application the updated look of the newer OS's.

SCBWV 71 Junior Poster

Microsoft promised to make VB6 programs "just work" in Vista because there's a TON of classic VB code out there in business and industry - a segment VERY reluctant to upgrade operating systems. Yes, they have a ton of legacy code... and it works for them. And re-writing or converting would cost millions. Unfortunately, MS didn't promise to make the VB development environment work.

Oddly enough, the COM object model still exists... even in some MS programs sold today, so I doubt it will disappear soon.

As you mentioned, one of the strengths of classic VB was the ability for the masses to learn and use... which spawned some real creativity. Sadly, i think we're reverting back to programming as a specialty, without a language for the "masses." Lot's of people did cool things with classic VB that won't have the time to invest in learning any variation or C. I understand languages and OS's have to evolve, but I think they could have made a smoother transition.

I don't make my living coding... but I do make some nice change selling a commercial app written in classic VB to a specialized vertical market.

SCBWV 71 Junior Poster

Guess I'm not quite sure what you want to do, but if you want to sun the Windows Installer you can Shell the installer with the MSI file as a parameter. For example:

Ret = Shell("MSIEXEC /I " & Combo1.Text, vbNormalFocus)

Assuming Combo1.Text contains the name of the .MSI file.

If the file has spaces in the name, be sure to include quotes:

Ret = Shell("MSIEXEC /I " & Chr$(34) & Combo1.Text & Chr$(34), vbNormalFocus)

SCBWV 71 Junior Poster
SCBWV 71 Junior Poster

I don't believe the control allows you to set volumes. You can use waveOutSetVolume and waveOutGetVolume in MMSYSTEM.DLL.

I prefere to use the old MCIWNDX.OCX control which allows adjusting speed and volume.

SCBWV 71 Junior Poster
Comatose commented: Nice Find! +8
SCBWV 71 Junior Poster
Comatose commented: Nice Find. +8
SCBWV 71 Junior Poster

Why not just save the richtextbox contents?

SCBWV 71 Junior Poster

One way is to separate the hours from the minutes and add them up = 42 hours, 172 minutes. Divide the minutes by 60 using INT divinsion - 172\60 = 2 or INT(172/60) = 2, so you have to add 2 hours to the 42 = 44 hours. To get the remaining minutes, use 172 MOD 60 = 52. Thus 44 hours 52 minutes.

SCBWV 71 Junior Poster

If you're using the RichTextBox, this may help. http://www.vbforums.com/showthread.php?t=275310

SCBWV 71 Junior Poster

A friend asked me to write a program that dials a telephone number and checks for the presence of a 1000 Hz tone. Any suggestions?

SCBWV 71 Junior Poster

The Str function returns a leading space for the sign of number. Could that be messing you up? Sinec the leading space is there, you could use "R01" & str$(99)

SCBWV 71 Junior Poster

Why are you using extra quotes?

ScriptPathandFile = "S:\DsnTools\Drawing Search Tool\UNIT ARRAY\" & ScriptFileName

should do just fine

SCBWV 71 Junior Poster

There is no Value property in a VB 6 timer.

The Interval property specifies the number of milliseconds between calls to a Timer control's Timer event. For example, if set to 10, the Timer1.Timer event will exceute every 10 milliseconds. Disabling a Timer control by setting Enabled to False cancels the countdown set up by the control's Interval property.

I would try setting the Interval property and the Enabled property to True in the code for your Start button, and set these to 0 and False in your Stop button. According to Microsoft, "When a Timer control is enabled, its countdown always starts from the value of its Interval property setting."

SCBWV 71 Junior Poster

Try resetting the Interval property.

SCBWV 71 Junior Poster

Yes, the SysInfo control has an event called DisplayChanged which fires when the screen resolution has been changed. It has many others, including one for SysColorsChanged, several for battery status, power changes and device arrival/removal.

SCBWV 71 Junior Poster

No, never figured it out. And if you eliminate the common controls, you lose the XP theme, but it does fix the problem. Wish I knew what was going on.