Ive already tried to use the size property to fix my problem but it never made a difference, I have also tried to use auto size and disable the scroll bar but nothing has worked. I am using a reportviewer control that takes up the whole of the form. The code that I have behind the form is below:
Code:Imports System.Data.OleDb Imports System.IO Imports System.Drawing.Printing Public Class Receipt Public PicLocation As String Dim Ctrl1, Ctrl2 As Control Dim CN As New OleDb.OleDbConnection Dim CMD As New OleDb.OleDbCommand Dim DataR As OleDb.OleDbDataReader 'To display into datagrid purpose Dim dataS As New DataSet Dim dataAd As New OleDb.OleDbDataAdapter Public SqlStr, SqlStr1, DBPath, DBStatus, SearchBox As String Dim X, Y, SqlH, Onh As Integer Dim SqlUser As String Dim DataP As Decimal Dim Balance As Integer Private Sub Receipt_Load(sender As Object, e As EventArgs) Handles MyBase.Load 'TODO: This line of code loads data into the 'ProductListDataSet' table. DBPath = (Application.StartupPath & "\ProductList.accdb") If CN.State = ConnectionState.Open Then CN.Close() DBStatus = ("Not Connected") End If SqlStr = ("Provider = Microsoft.ACE.OLEDB.12.0;Data Source =" & DBPath) CN.ConnectionString = SqlStr CN.Open() Onh = Nothing lblTime.Text = DateAndTime.Now lblUser.Text = Login.userTB.Text Dim sql As String sql = "SELECT * Receipt" Me.ReceiptTableAdapter.ClearBeforeFill = True Me.ReceiptTableAdapter.Connection = CN Me.ReceiptTableAdapter.Connection.CreateCommand.CommandText = sql Me.ReceiptTableAdapter.Fill(Me.ProductListDataSet.Receipt) Me.ReportViewer1.RefreshReport() Me.Refresh() End Sub Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click With Me.PrintForm1 .PrintAction = Printing.PrintAction.PrintToPrinter Dim MyMargins As New Margins With MyMargins .Left = 0 .Right = 0 .Top = 0 .Bottom = 0 End With .PrinterSettings.DefaultPageSettings.Margins = MyMargins .Print(Me, PowerPacks.Printing.PrintForm.PrintOption.CompatibleModeClientAreaOnly) End With End Sub End Class




Reply With Quote