Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1263
  • Last Modified:

Changing column width programatically in crystal report

I'm using vb.net 05 and i have a simple click command to create a crystal report and then print it.  Here's my code:

  Private Sub btnSearchPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearchPrint.Click
        crystalReport11.SetDataSource(ds2.Tables(0))

        crystalReport11.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Landscape
        crystalReport11.PrintToPrinter(1, True, 0, 1)
 End Sub

Now it prints just fine, but the columns have a predetermined width, which cuts off some of the text.  I want to know if I can tell it which columns will be what width?      
0
DustinHinkel
Asked:
DustinHinkel
2 Solutions
 
mlmccCommented:
You can but then you would have to move the columns that are to the right.

Is this an existing report?
YOu can set the field to grow.  they will grow vertically.

mlmcc
0
 
VBRocksCommented:
If you want to set the width of a field programmatically, you can do it using the ReportObjects, and
the name of the field, for example:

        Dim cr As New CrystalReport1()
        cr.ReportDefinition.ReportObjects("Column11").Width = 5000
        cr.SetDataSource(ds)

0
 
DustinHinkelAuthor Commented:
thanks guys.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now