Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Setting Print Margins In An Rtf Control


I see that you can set the RightMargin, but how do i set the rest? I looked up the print method but it seems i can only set the left and top... Is there a way to just set the margins within the rtf control?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Setting Margins
Okay, I searched the board first to see if anyone had already asked this question and they had. However, the answers were sparse. I was wondering if anyone knew how to set margins when you print. Here is the code I use to print:


VB Code:
Printer.Print txtResults.Text    Printer.EndDoc


There you go. Thats it. txtResults is a multiline text box. I just want to move it all down an inch and to the right an inch. Any suggestions?

Setting Margins In VB
Hi,

I've combed the forum and have found close answers, but not quite what I need.

I have a textbox that contains a list of info that's delimited by carriage returns a la:

Item 1
Item 2
Item n

My issue is this, I need to print this list out with a 1" margin. When I use the CurrentX prop and print the textbox, I get:

Item 1
Item2
Item n

As you can see, this sucks!
How do I tell the printer to indent 1" every time CurrentY increases when printing this textbox's contents?

Thanks,
Jeff

Setting Margins For .PrintForm
I'm trying to print 2 forms side by side on a landscape orientated paper. And have each printed form centered on its half of the paper. The problem I'm having is that by default the margins are set to move the printed form in almost an inch from the left/top/bottom/right of the paper which makes it impossible for me to center it. All I want to do is set all the margins to 0 so i can specify the x,y coordinates to print but when using .PrintForm i seem to have no luck doing this.

My ultimate goal is to create something like a book. Where you fill in information on forms then it prints the pictures/text onto paper and numbers the pages, but obviously without centering it on the paper it won't look right.

FORM1 FORM2
___________
| xxxx | xxxx |
| xxxx | xxxx |
| xxxx | xxxx |
|_____|_____|

Each form gets half a sheet


Any suggestions as to how to do this? Each form has multiple captions/picturesboxes that need to be printed and aligned. I considered sending the whole form to a picturebox before printing and then aligning the picturebox but didn't know if there was an easy way of doing that besides painting every control onto the form and using Pic.Picture = Form.Image which would be very tedious since im printing over 30 different forms and probably 200 controls.

Setting Page Margins
I am using the Priter object for a print job.
I need to change the bottom page margin
at run time thru my code. Is there an API
that will do it. I do not want to use the API that
pops up the dialog box since it has to be done without user
interaction. Is there another way to do it?

Setting Printer Margins?
The problem is probarly quite simple!! How do you set the margins, the place that the printer start to print from, in the printer module???

I write:

Printer.Print "Something"


and the text "Something" is at the top left corner!! How do I set the printer to print it another place??

Setting Printer Margins Using API
Does anybody know how to use the Windows API to set the margins of a page in a particular printer.

Thanks.

Setting Printer Margins
When printing I try forcing the printer margins so my report is always printing the same regardless of what printer I am connected to. Below is what I have tried but the printing alignment is still not the same when I compare the same report from different printers.

myReport.TopMargin = 240
myReport.BottomMargin = 240
myReport.LeftMargin = 240
myReport.RightMargin = 240

Any suggestion? Thanks in advance.

Setting Printer Margins In Access
Hi All,


Can anyone point me in the right direction with using automation to control printer margins in my Access reports? My reports print OK on my own printer but on some other printers, each report page spills over to a second page. It doesn't look good.


Thanks and regards,


Gerard

Setting Margins With The Printers Collection
Is there some arcane way to change the margins (top, left, bottom, right) of the Printers object i am accessing?

I see everything from papersize to orientation to colormode, but nothing for Margins.

Thanks

Problem Setting Margins In Word Remotely
Hello,
I'm trying to remote Word from MSAccess. When I try to set the margins I get the following error:

"The remote server cannot be found of is unavailable"

This error only occurs about 20% of the time. That's what has me confused.

Everthing else I'm attempting works fine.

Here is my code


Code:
Public Sub Main()
On Error GoTo err1
Dim oApp As New Word.Application
oApp.Documents.Add
oApp.DisplayAlerts = wdAlertsNone
With oApp.ActiveDocument.PageSetup
.TopMargin = InchesToPoints(0.75)
.LeftMargin = InchesToPoints(0.75)
.RightMargin = InchesToPoints(0.75)
.BottomMargin = InchesToPoints(0.75)
End With
With oApp.Selection
With .Font
.Name = "Arial Black"
.Size = 16
.Bold = True
End With
.TypeText "Test Text1" & vbCrLf
.TypeText "Test Text2"
End With
oApp.ActiveDocument.SaveAs (oApp.StartupPath & "Test002.doc")
oApp.Application.Visible = True
ex1:
Exit Sub
err1:
Select Case Err.Number
Case 462
Resume Next
End Select
Debug.Print Err.Number
MsgBox Err.Description
oApp.Quit
Resume ex1

End Sub

Print Margins??????
How do you set the margins for the printer?

I'd like to set all the margins to 3/4"

The MSDN Visual Basic 6.0 library gives the following code to center a form that is being printed. That's all I can find. How do you set the margins to a specific number? First of all is ScaleLeft and ScaleTop even the commands to use for the margins of the printer????

VB Code:
Printer.ScaleLeft = -((Printer.Width - PFrm.Width) / 2)Printer.ScaleTop = -((Printer.Height - PFrm.Height) / 2)

Print Margins
I'm having a problem setting the margins for my program. I've tried using:


Code:
Printer.ScaleMode = vbInches
Printer.ScaleLeft = 1
Printer.ScaleTop = 1


Then I print the following:


Code:
Printer.CurrentX = 0
Printer.CurrentY = 0
Printer.Print "0"

Printer.CurrentX = 1
Printer.CurrentY = 1
Printer.Print "1"

Printer.CurrentX = 2
Printer.CurrentY = 2
Printer.Print "2"


The "0" doesn't show up. "1" Shows up on page two, but its about .5 inches from the left of the page, and about .25 inches from the top. "2" shows up on page three, about 1.5 inches from the left, and .25 inches from the top. I've tried varying the ScaleMode, ScaleLeft, and ScaleTop properties and I keep getting weird stuff. I just want the program to set one-inch margins on each side of the paper.

Thanks for any suggestions.

Print Margins
how can i set the top en left margins with the printer.print function?

thanks in advance!

Report Print Margins
Hi

How can I set a reports print margins in code? When I open a report in print preview sometimes the margins are wrong and the page has changed to landscape.

Cheers

VB Print Object Margins
In my vb app I print list of stuff in landscape mode. The probelm I
have is that on some printers the printing starts too much to the right, leaving a big margin on the left-hand side. On other printers it prints fine. Also on some printers the actual position (x and y) of headings differ on different printers. Is there any way that I can prevent this ? Thanks

Printer.Print Margins
Hi Everyone,

I am trying to create some printing code that prints in letter format. For example, having margins equal 1 inch on every side, top, bottom, left and right. I am not sure how to do this though. Any ideas? Also, I want to be able to have the text wrap around to the next line when it hits the end of this boundry. I would appreciate any help on how to do this. Thanks.

How To Set Excel Print Preview Margins
Hi: I'm setting-up a print preview of a Excel worksheet in VB. I tried to cut and paste some VBA code I once used to do this but the code:

With ActiveSheet.PageSetup
.
.
.LeftMargin = Application.InchesToPoints(0.75)

blows out with an error: "Method or data member not found" with the .InchesToPoints highlighted.

My questions are: do I need to pull in a reference to a library to make the method available to resolve this? Or, is this just not supported in pure VB? And, is there a better way to set spreadsheet print margins in VB?

Dynamically Setting Pages To Print. Crystal Report Control
How do I set the pages/copies to print for a CrystalReport control. i.e. so when the report loads the user can just hit print, I can have the copies to print set to two.

I know this is possible becauseI have a report that does it, I just can't figure out how to set this. I think it might be set in the report.

Thanks if anyone can help, or point me in the direction of assistance.




Edited by - adamkushner on 3/27/2003 4:56:49 AM

Data Report Margins/Print Problem
I'm trying my post here since most of the views appear to be in the General VB forum........

I'm somewhat of a newbie with the MS Data Report designer. I'm having problems getting the margins correct. I need to have a label 1/4" from the top and left of my report. However, even when setting my margins to 0, the report still prints with a 1/2" margin. The preview of the report looks correct. I saw another post here suggesting a service pack update for VB 6.0. I've update to sp5 with no success. Any suggestions or advice is greatly appreciated!!

How To Set "Print Margins"?
Hi,

I did do a quick search for this but did not seem to find anything that fits my problem.

What I cant figure out how to do is to force printing at a specific margin. For example, I am printing a work order form. THe name, address, phone number etc is printed at about .5 inches from the left of the page and starts printing about 1 1/8 inches from the top.

Using the standard ole method:

Code:
printer.currentx = 0.5 * 1440 start printing 1/2 inch from left edge
Printer.Currenty = (1 + (1/8)) * 1440 ' start printing 1 1/8th inch from top
Printer.Print CustomerInfo!LastName & " , " & CustomerInfo!FirstName


So far so good. It starts printing the block of text where I want it. Now the issue I am having is while VB gladly advances the Currenty to the next line, unless I tell it every time before I print that CurrentX is 0.5 * 1440 it will print the next line at 0.


I know you can use a semi colon to force currentY to stay put (ie: Printer.print CustomerInfo!Address1;

But is there a way to make the current X stay put so I dont have to tell it EVERY FREAKING TIME I want it at 0.5 inches? It sure would be helpful.

thanks in advance

How Do I Set "right" Print Margins
I have a program which quite a few people on this forum have helped me build. The program is a basic database search engine which displays results both in a datagrid and in Labels on the form.

I have setup another form to be the exact size of the label from my Zebra label printer, when i click print the label prints but cuts off the right half of the information.

N.B. When i print to a normal A4 printer, the information looks perfect.
I tried a Data Report, it sent 56,938 records to my printer... Hence the form.

Any help with the print margins would be fantastic...

Thanks

Setting Print Quality
Hello,

I am trying to set the print quality to the maximum before sending a print job in VB:

objPrinter.PrintQuality = vbPRPQHigh

However, I get the message:

'PrintQuality' Property is read only.

In the Default printer setting the print quality is set to 1200 which is the maximum. But when I check the printquality value in the code above this value is only to 600. That's what I want to code this value to it's maximum.

Any idea?

thanks

Print Setting For Datareport In VB6
Hon'ble gurus,
I am using VB6,Access2000 & Datareport in my project.
When I load the project in different computers and they take out the printing in different PRINTERS, the default margin of the report gets changed. Apart from this, when I want to take out the printing in the half of the A4 size paper, I am to go to print setting to customize the page setup.
Is it possible to set the papersize(half of A4 paper) through VB? If yes, then how?
Please help me.
Regards,
pkb_pkb

pkb_pkb

Change Print Setting To Landscape
I want to print a table using the nice and easy
DoCmd.SelectObject acTable, strDocName, True
DoCmd.PrintOut

But I want to have it print in landscape. I just got done reading the PrtDevMode help and am hoping I don't have to use that.

Is there an easy way to set it to print in Landscape?

Changing Print Setting (Color Etc)
Hi There,

I have been using a brilliant code which captures a screen print of my form and opens up the print window to print. It works well, except that I am unable to successfully change any of the settings such as color, quality etc. I can change them in the printing preferences window, but they seem to revert back to the default settings. I have partially solved this by going into the Printer properties and setting a profile of how I want the print job to be (i,e with Color) and setting this as default. Therefore when I go to print from my program it will use these new setting I set up. However my customer are going to want to choose their own settings from the print pop up window and not have to do what I have done. Is there any way I can change the below code to allow the users to successfully change the print settings via the print window that pops up.

Option Explicit

'Normal font weight i.e. not bold
Public Const FW_NORMAL = 400
'Default font character set
Public Const DEFAULT_CHARSET = 1
'Default font precision mapping
Public Const OUT_DEFAULT_PRECIS = 0
'Default font clipping precision
Public Const CLIP_DEFAULT_PRECIS = 0
'Default font quality
Public Const DEFAULT_QUALITY = 0
'Default font pitch
Public Const DEFAULT_PITCH = 0
'San serif font
Public Const FF_ROMAN = 16
'Use printer compatible fonts
Public Const CF_PRINTERFONTS = &H2
'Use screen compatible fonts
Public Const CF_SCREENFONTS = &H1
'Use both printer and screen compatible fonts
Public Const CF_BOTH = (CF_SCREENFONTS Or CF_PRINTERFONTS)
'Unknown (deals with fonts)
Public Const CF_EFFECTS = &H100&
'Font has to exist to use it
Public Const CF_FORCEFONTEXIST = &H10000
'Font common dialog will show up with settings set in font structure
Public Const CF_INITTOLOGFONTSTRUCT = &H40&
'Unknown
Public Const CF_LIMITSIZE = &H2000&
'Normal font weight i.e. not bold (same as FW_NORMAL)
Public Const REGULAR_FONTTYPE = &H400
'Minimum required face size returned by font common dialog box
Public Const LF_FACESIZE = 32
'Maximum size of devices name
Public Const CCHDEVICENAME = 32
'Maximum size of form name
Public Const CCHFORMNAME = 32
'Allow memory to be moved/resized
Public Const GMEM_MOVEABLE = &H2
'Initiate memory space to zero
Public Const GMEM_ZEROINIT = &H40
'Turns duplexing (double sided pages) to on
Public Const DM_DUPLEX = &H1000&
'Allow paper orientation to be changed
Public Const DM_ORIENTATION = &H1&
'Show printer setup dialog instead of normal print dialog
Public Const PD_PRINTSETUP = &H40
'Disable print to file check box
Public Const PD_DISABLEPRINTTOFILE = &H80000

'Defines a location using X, Y coordinate system
Public Type POINTAPI
x As Long
Y As Long
End Type

'Defines a rectangular region
Public Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

'Structure to define options for the open common dialog
Private Type OPENFILENAME
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type

'Structure to define options for the page setup common dialog
Private Type PAGESETUPDLG
lStructSize As Long
hwndOwner As Long
hDevMode As Long
hDevNames As Long
flags As Long
ptPaperSize As POINTAPI
rtMinMargin As RECT
rtMargin As RECT
hInstance As Long
lCustData As Long
lpfnPageSetupHook As Long
lpfnPagePaintHook As Long
lpPageSetupTemplateName As String
hPageSetupTemplate As Long
End Type

'Structure to define options for the color chooser common dialog
Private Type CHOOSECOLOR
lStructSize As Long
hwndOwner As Long
hInstance As Long
rgbResult As Long
lpCustColors As String
flags As Long
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type

'Structure to define options for a font
Private Type LOGFONT
lfHeight As Long
lfWidth As Long
lfEscapement As Long
lfOrientation As Long
lfWeight As Long
lfItalic As Byte
lfUnderline As Byte
lfStrikeOut As Byte
lfCharSet As Byte
lfOutPrecision As Byte
lfClipPrecision As Byte
lfQuality As Byte
lfPitchAndFamily As Byte
lfFaceName As String * 31
End Type

'Structure to define options for the font common dialog
Private Type CHOOSEFONT
lStructSize As Long ' size of this very structure
hwndOwner As Long ' caller's window handle
hDC As Long ' printer DC/IC or NULL
lpLogFont As Long ' ptr. to a LOGFONT struct
iPointSize As Long ' 10 * size in points of selected font
flags As Long ' enum. type flags
rgbColors As Long ' returned text color
lCustData As Long ' data passed to hook fn.
lpfnHook As Long ' ptr. to hook function
lpTemplateName As String ' custom template name
hInstance As Long ' instance handle of.EXE that
' contains cust. dlg. template
lpszStyle As String ' return the style field here
' must be LF_FACESIZE or bigger
nFontType As Integer ' same value reported to the EnumFonts
' call back with the extra FONTTYPE_
' bits added
MISSING_ALIGNMENT As Integer
nSizeMin As Long ' minimum pt size allowed &
nSizeMax As Long ' max pt size allowed if
' CF_LIMITSIZE is used
End Type

'Structure to define options for the print common dialog
Private Type PRINTDLG_TYPE
lStructSize As Long
hwndOwner As Long
hDevMode As Long
hDevNames As Long
hDC As Long
flags As Long
nFromPage As Integer
nToPage As Integer
nMinPage As Integer
nMaxPage As Integer
nCopies As Integer
hInstance As Long
lCustData As Long
lpfnPrintHook As Long
lpfnSetupHook As Long
lpPrintTemplateName As String
lpSetupTemplateName As String
hPrintTemplate As Long
hSetupTemplate As Long
End Type

'Structure to hold data about each printer
Private Type DEVNAMES_TYPE
wDriverOffset As Integer
wDeviceOffset As Integer
wOutputOffset As Integer
wDefault As Integer
extra As String * 100
End Type

'Structure to hold data about each printer
Private Type DEVMODE_TYPE
dmDeviceName As String * CCHDEVICENAME
dmSpecVersion As Integer
dmDriverVersion As Integer
dmSize As Integer
dmDriverExtra As Integer
dmFields As Long
dmOrientation As Integer
dmPaperSize As Integer
dmPaperLength As Integer
dmPaperWidth As Integer
dmScale As Integer
dmCopies As Integer
dmDefaultSource As Integer
dmPrintQuality As Integer
dmColor As Integer
dmDuplex As Integer
dmYResolution As Integer
dmTTOption As Integer
dmCollate As Integer
dmFormName As String * CCHFORMNAME
dmUnusedPadding As Integer
dmBitsPerPel As Integer
dmPelsWidth As Long
dmPelsHeight As Long
dmDisplayFlags As Long
dmDisplayFrequency As Long
End Type

'color chooser common dialog
Private Declare Function CHOOSECOLOR Lib "comdlg32.dll" Alias "ChooseColorA" (pChoosecolor As CHOOSECOLOR) As Long
'open common dialog
Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
'save common dialog
Private Declare Function GetSaveFileName Lib "comdlg32.dll" Alias "GetSaveFileNameA" (pOpenfilename As OPENFILENAME) As Long
'print common dialog
Private Declare Function PrintDialog Lib "comdlg32.dll" Alias "PrintDlgA" (pPrintdlg As PRINTDLG_TYPE) As Long
'page setup common dialog
Private Declare Function PAGESETUPDLG Lib "comdlg32.dll" Alias "PageSetupDlgA" (pPagesetupdlg As PAGESETUPDLG) As Long
'font common dialog
Private Declare Function CHOOSEFONT Lib "comdlg32.dll" Alias "ChooseFontA" (pChoosefont As CHOOSEFONT) As Long
'copies a block of memory from one location to another
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)
'locks a global memory object and returns a pointer to the first byte of the objectís memory block
Private Declare Function GlobalLock Lib "kernel32" (ByVal hMem As Long) As Long
'decrements the lock count associated with a memory object that was allocated with the GMEM_MOVEABLE flag
Private Declare Function GlobalUnlock Lib "kernel32" (ByVal hMem As Long) As Long
'allocates the specified number of bytes from the heap
Private Declare Function GlobalAlloc Lib "kernel32" (ByVal wFlags As Long, ByVal dwBytes As Long) As Long
'frees the specified global memory object and invalidates its handle
Private Declare Function GlobalFree Lib "kernel32" (ByVal hMem As Long) As Long

'Variable to hold open common dialog structure
Dim OFName As OPENFILENAME
'Variable to hold custom colors
Dim CustomColors() As Byte

Setting Excel Print Area
How do I set the print area of a sheet from an Excel Macro?

Setting Excel Print Area
Good morning people. I am creating a spreadsheet in which users will enter columns of data in an unknown number of rows (<1000). Also the totals will be on row 1000 and can be viewed in a split screen situation. My problem is, I want to set a print range (not for the whole 1000 rows) to include the occupied cells + row 1000. By default Excel will print only the occupied cells on a given page. I just want to utilize Excel's default "print area" and add the cells on line 1000 without printing a bunch of blank pages. Any suggestions?

Thank you, DAVE

Setting A Range Equal To That Of The Print Area
I have found code that will allow me to attach a certain range, on an excel sheet, into an outlook e-mail and then send it.

However, it requires you to select the range.

The range I want sent, happens to be the same range as the printable area.

Is there a way to just have the rangeToSend = printArea?

Setting Print Area Using Variables In Excel
I am in need of some help on using variables in setting up in an
Excel Report I am working on.

I have different reports that output to Excel. I want to be able
to format these reports thru VBA, because when they are saved as
Excel from BusinessObjects, they are usually not very well
formatted. I want to be able to format these Excel Sheets
without having to go into each of them and format them manually.
I have been able with help from some of you to do that. Now
comes the last hurdle.

I want to be able to find the last cell that contains data (which
I have been able to). Then use that to set the print area,
before printing.

Below is the code that I use. It comes from a recorded macro
which I modified and it works. I now want to substitute my
variable r to replace the 4350. I have tried various methods and
none works.

Any ideas or suggestions will be greatly appreciated.



MsgBox ("First Empty Cell is at : " & r)
Range("A1:G4350").Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$G$4350"
ActiveWindow.View = xlPageBreakPreview
ActiveWindow.SmallScroll Down:=-21
Range("A1").Select
ActiveSheet.PageSetup.PrintArea = "$R$4350"
Range("A1:G4350").Select
' Range("A4262").Activate

'============================
ActiveWindow.SmallScroll Down:1
Rows("4351:29178").Select
Selection.Delete Shift:=xlUp
Selection.Delete Shift:=xlUp
Selection.Delete Shift:=xlUp
'Range("A4290:G4309").Select
' Selection.Delete Shift:=xlUp

I Need Help With Setting Up Width And Height To Display It In Print Preview
I have problems with coding on how to specify the height and width of area where my inputted text in txtbox will appear pls someone help me this is the code below:
vb Code:
Option Explicit       Private Sub cmdPreview_Click()         Dim dRatio As Double         frmPreview.Show         dRatio = ScalePicPreviewToPrinterInches(frmPreview.Picture1)         PrintRoutine frmPreview.Picture1, dRatio               End Sub      Private Sub cmdPrint_Click()        Printer.ScaleMode = vbInches        PrintRoutine Printer        Printer.EndDoc     End Sub       Private Function ScalePicPreviewToPrinterInches _         (picPreview As PictureBox) As Double          Dim Ratio As Double ' Ratio between Printer and Picture         Dim LRGap As Double, TBGap As Double         Dim HeightRatio As Double, WidthRatio As Double         Dim PgWidth As Double, PgHeight As Double         Dim smtemp As Long          ' Get the physical page size in Inches:         PgWidth = Printer.Width / 1440         PgHeight = Printer.Height / 1440          ' Find the size of the non-printable area on the printer to         ' use to offset coordinates. These formulas assume the         ' printable area is centered on the page:         smtemp = Printer.ScaleMode         Printer.ScaleMode = vbInches         LRGap = (PgWidth - Printer.ScaleWidth) / 2         TBGap = (PgHeight - Printer.ScaleHeight) / 2         Printer.ScaleMode = smtemp          ' Scale PictureBox to Printer's printable area in Inches:         picPreview.ScaleMode = vbInches          ' Compare the height and with ratios to determine the         ' Ratio to use and how to size the picture box:         HeightRatio = picPreview.ScaleHeight / PgHeight         WidthRatio = picPreview.ScaleWidth / PgWidth          If HeightRatio < WidthRatio Then            Ratio = HeightRatio            smtemp = picPreview.Container.ScaleMode            picPreview.Container.ScaleMode = vbInches            picPreview.Width = PgWidth * Ratio            picPreview.Container.ScaleMode = smtemp         Else            Ratio = WidthRatio            smtemp = picPreview.Container.ScaleMode            picPreview.Container.ScaleMode = vbInches            picPreview.Height = PgHeight * Ratio            picPreview.Container.ScaleMode = smtemp         End If          ' Set default properties of picture box to match printer         ' There are many that you could add here:         picPreview.Scale (0, 0)-(PgWidth, PgHeight)         picPreview.Font.Name = Printer.Font.Name         picPreview.FontSize = Printer.FontSize * Ratio         picPreview.ForeColor = Printer.ForeColor         picPreview.Cls          ScalePicPreviewToPrinterInches = Ratio      End Function       Private Sub PrintRoutine(objPrint As Object, _                               Optional Ratio As Double = 1)         ' All dimensions in inches:          ' Print some graphics to the control object                  objPrint.Line (0.2, 0.72)-(3 + 5.2, 0.2 + 0.5), _                        RGB(0, 0, 0), BF         objPrint.Line (6.5, 1)-(3 + 5.2, 0.2 + 0.5), _                        RGB(0, 0, 0), BF         objPrint.Line (0.2, 1)-(3 + 5.2, 0.2 + 1.1), _                        RGB(255, 255, 255), BF         objPrint.Line (0.2, 1.65)-(3 + 5.2, 0.2 + 1.1), _                        RGB(0, 0, 0), BF          ' Print a title         With objPrint            .Font.Name = "FONT399"            .CurrentX = 0.2            .CurrentY = 0.5            .FontSize = 12 * Ratio            objPrint.Print "XPRESS WEB STUDIO"         End With          ' Print some text                         With objPrint                        .Font.Name = "Arial"            .FontSize = 10 * Ratio            .CurrentX = 0.4            .CurrentY = 1.8            objPrint.Print "ASSIGNED TO : "                        .FontSize = 10 * Ratio            .CurrentX = 4.44            .CurrentY = 1.8            objPrint.Print "DATE GIVEN : "                        .FontSize = 10 * Ratio            .CurrentX = 4            .CurrentY = 2.1            objPrint.Print "SUBMISSION DATE : "                .FontSize = 9 * Ratio            .CurrentX = 1.6            .CurrentY = 1.81            objPrint.Print Text1.Text                        .FontSize = 9 * Ratio            .CurrentX = 5.5            .CurrentY = 1.81            objPrint.Print Text2.Text                        .FontSize = 9 * Ratio            .CurrentX = 5.5            .CurrentY = 2.12            objPrint.Print Text3.Text                        .Font.Name = "Arial"            .FontSize = 8 * Ratio            .CurrentX = 6.7            .CurrentY = 0.8            .ForeColor = vbWhite            objPrint.Print "www.xpresswebstudio.com"                        .Font.Name = "Arial"            .FontSize = 12 * Ratio            .CurrentX = 0.4            .CurrentY = 1.36            .FontBold = True            objPrint.Print "WORK ORDER FORM"          End With      End Sub

Setting A Control's Container To A Member Of A Control Array At Runtime
Apologies for making two threads in the same day, but it's obviously just not my day. =

I'm trying to set the container of an ADODC to one of any number of frames in a control array. The array is named frmDataEntry, the ADODC is dbcShop. The code is as follows-
Code:
Set dbcShop.Container = frmDataEntry(0)
That's it. It will be used later with a variable for the index, but that's the essence of it. The problem I'm getting is that it's setting dbcShop.Container to frmDataEntry(0).Caption instead of just frmDataEntry(0) as a Frame. I tried making a bridge variable, doing
Code:
Dim frmContain as Frame
Set frmContain = frmDataEntry(0)
Set dbcShop.Container = frmContain
But I get the same problem. Any suggestions? From what I know I'm trying the right approach, but I may be overlooking something.

Setting Custom Control Value To Am. Control Array
Hello,
I have a custom control with an array of 3 option boxes.  I have tried about 9 different ways to set the value of the control to the array index but it always bombs out.  Is there a possible solution to this or do I need to find another way of doing this?

Thank in advance.

Graph/Chart Control, Print Preview Control.
Does anybody know of some good chart/graph and print preview controls, free if possible but will pay

Tab Control And Setting Tab
Can anyone tell me how to set the propertys on a tab control function eg, if I had 4 tabs and on the first tab I wanted to put a list box, the 2nd tab I wanted a text box ,3rd tab a lable, 4th tab a picture box, how do I set them and make it work

thanks
Linetoe

Setting Control Box To 0, Or A Default
This is a pretty simple one I'm sure, I just didn't see anything on MSDN.
Here's what I have so far but it may be of no use:

Code:
If strPurCost = "" Then
strPurCost = "0.00"
End If
I want the text box to come up with a value of 0.00, or 0, if there is nothing in that variable when the application is started. I couldn't figure out how to do it in the frm window so I looking into doing it with code.
Does anyone know how to do this?
Thanks!

Setting Control Properties
Can anyone give me any adv ice on the best way of setting control properties. I.e. before run time in the ide or on the for load event. For example say i have 10 textboxes which all have to enabled or locked or something when the program first loads but they will change at somepoint during the program. Does that make sense?

So would you hardcode it into the form load event or just set them in the ide?

Setting Control Array As Whole
lets say I have 50 checkboxes.. can I set the array as a whole
to a color at run time or do I need to set every index ?

kinda like if you selected them all are design time and then
just changed the backcolor as a whole for all of them ,...

Setting A Control's Container
I'm trying to load arrays of picture boxes with a label inside each one. Of course, I load the picture box first, but then the new label is inside the other picture box. How do I make the new picture box the label's container?

Label1(1).Container = ??

Edit:

SET Label1(1).Container = Picture1(1)

Comm Control Setting ???
hello everyone !!

i've written the following code to set the comm port

if mscomm1.portopen=true then
mscomm1.portopen=false
end if

mscomm1.commport=1
mscomm1.settings="9600,N,8,1"
mscomm1.portopen=true


on one of my testing systems, its giving the error = 8012, Device not open.

i've checked for error =8005, port not open. but i'm not able to debug this one. its giving many problems ......

can anyone pls tell me how to debug this error. what is the possible problem due to which its coming ....

my system , in which i've developed this app, does not give this error.

pls help

thanks
shruti !

Setting CDC Control Path
Hi
could anyone tell me how to set the common dialogs control to point to a certain path?. For example I want it to goto App.Path.
Thanking you in advance
PORRASTAR

Setting Up A ListView Control
I am new to working with the ListView control. The following works OK

Code:
'Create Column Headers
Dim Title As ColumnHeader
ColWidth = ListView1.Width / 5
Set Title = ListView1.ColumnHeaders.Add(, , "TextHere", ColWidth)


Now I want to add text to the first column, first row. I tried:

Code:
Set ListItem = ListView1.ListItems.Add(, , "NewText")


For some reason it didn't work - no text is entered into the control. What am I missing?

Also, how can I set the text of the column headers and the List Items to bold?

Setting Focus To Next Control
Is there an easy way to move to the next control in the tab list and give it focus, in effect emulating pressing the TAB key.

My particular problem is that I have a command button which, once clicked, I want focus to move the next control. However, at run-time I don't know which it is, as various controls could have been loaded, and/or enabled/disabled. Pressing the TAB key gets me to the right control, so how do I emulate it in code.

I realise I could go through each control to find the next one, but thought there may be an easier way.

Setting ADO Control Version 2.1
I need to install the ADO control version 2.1 instead of version 2.5, where do I make this change?
The change is neimprotant because of run time time error 429.

Setting Control Properties (*.ocx)
How do i set the properties that i make in an ocx. I went to tools and added them yes. then i tried various ways of setting them, but the keep going back to what i set them as and you can not change them. Also i am having a lot of trouble making a background (you know the menu where you select it) if you can help, thanks a bunch. i am gonna try and find some more demos.

: )

Setting The Data Control
Hi,

Is there any way to change the Data Control's databasename to random.
I have package my project so when other person install the program at their own pc, the text file not found.
How to set this up?
 

Smile always
"Laugh is a medicine for all sickness ...
so plz laugh whatever you do"

Setting Independdent Control
Hello Friends,
I want to create a form which is independent to Graphics Setting of Microsoft Windows.
Is there any way????

I am in crying need. Pls help me...

Setting Control Properties...
Ok, I have a text file and it looks something like this:

Label:
Left=2760
Top=0
Width=855
Height=255
Caption=Item Name:

Textbox:
Left=3600
Top=0
Width=3015
Height=285
Tag=ItemName

Now, what I would like my program to do is read in this text file, create the controls, and set their properties. I don't have any trouble with the first two, but I was wondering if there is a way to set properties by doing something like

Code:

strProperty = "Left=2760"
lblLabel. & strProperty

instead of

Code:

If Mid(strProperty, 1, InStr(1, strProperty, "=", vbTextCompare) - 1) = "Left" Then
DoThis
ElseIf Mid(strProperty, 1, InStr(1, strProperty, "=", vbTextCompare) - 1) = "Top" Then
DoThat
End If

Any ideas? =)

Setting Control Properties In Frames
I have 2 frames, each with different control types and different number of controls in each frame.
I want to be able to call a routine to set the control properties, eg backcolour, font size etc for controls within the different frames.
I have the following code, but this colours eg for all controls on the form, I need to have controls in Frame1 enabled and certain colour, size etc and have the controls in Frame1 disabled and different colour , size etc
The code below changes all controls on the form, I can't work out how to segment Frame1 from Frame2

As I have alot of forms I would like to be able to have a procedure / function so I don't have to go through each
form, each frame and each control manually.

Dim chgControl As Control
For Each chgControl In Controls
chgControl.Font.Name = "Times New Roman"
chgControl.Font.Bold = True
If TypeOf chgControl Is TextBox Then
chgControl.BackColor = &HC0FFFF
End If
If TypeOf chgControl Is Label Then
chgControl.BackColor = &HC0C0FF
End If
If TypeOf chgControl Is CommandButton Then
chgControl.BackColor = &HFFC0C0
End If
If TypeOf chgControl Is fpDoubleSingle Then
chgControl.BackColor = &HFFC0C0
End If
If TypeOf chgControl Is fpDateTime Then
chgControl.BackColor = &HFFC0C0
End If


Next chgControl

Trouble Setting Display Control
I'm trying to create a table with a yesno field that has the displaycontrol set to "Checkbox"

Here is the relevant code


Code:
Dim dB as database, tblDef as tabledef, fld as field, prp as property

Set dB = CurrentDb()
dB.Execute "Create Table test123 (CheckMe yesno)"
Set tblDef = dB.CreateTableDef("test123")
Set fld = tblDef.Fields("CheckMe") 'This is where I get the error Item Not Found In this collection
Set prp = fld.CreateProperty("DisplayControl", dbInteger, acCheckBox)
fld.Properties.Append prp
Set prp = Nothing
Set fld = Nothing
Set tblDef = Nothing
Set dB = Nothing

Anyone help me with this one? I'm not sure about whether dbInteger is correct either but I haven't gotten to that point yet.

Copyright © 2005-08 www.BigResource.com, All rights reserved