Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Dynamically place fields at runtime using vb.net

Status
Not open for further replies.

paulcy82

Programmer
Jan 25, 2005
28
US
I need to know how to dynamically place my fields on my report at runtime. So when I run my VB.NET project, my form will open and run some SQL, create the Crystal Report and the fields that I want will be placed in my report. For example, if my table contains units, rev, and cost I want these fields placed right next to each other like so:

| UNITS | REV | COST |

I can't have any gaps between the fields either. Any info is much appreciated
 
Hi,
Usually the placement of fields is done in the report designer, but try this:
Have only one field ( make sure it is wide enough to contain all possible fields) and concatenate the returned data from your query into one long text string.
Depending on your database it would be something like

select trim(UNITS)}||trim(REV)||trim(COST) as mydata from databaseTable.

[profile]
 
I am not sure I understand what you are saying. I do not know how concat would get me my results. I am not sure if I am explaining enough. What I want is a VB.NET app that will open my report and the report calls some SQL and generates the fields that I need. Once these fields are visible in Crystals Field Explorer, I want my VB.NET app to place these fields on the details section of my report. I need the fields next to each other, that's all. I am thinking that my VB.NET app would start my first fields left top corner at (0,0). Then my app will find where the top right corner is or all my fields would be a set size so the top right corner could be a constant. after the right top of the first field is known, the second fields left top is placed at the same spot as the right top. I hope this clears things up, if not, I will try again. Thanks for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top