VB Crystal Report >> Changing PageHeader text object values at runtime

by Frank » Sat, 07 May 2005 06:48:08 GMT

I have a report with a set of custom fields(custom1 thru custom5) in the
details area. The labels which describe these fields are placed in the
PageHeader section, with text value of custom1 thru custom5. I want to
change the text value of the field labels at runtime.

I am opening the report from a RAS server. I have all the code setup to
open and save the report. I just need some help accessing the PageHeader
section and actually changing or adding the label with values. I have
tried modifying the Crystal provided sample code from the RAS SDK using
the Field and FieldObject objects with no success. The Crystal sample
adds/remove fields but does not acutally add field labels and the
Field.HeadingText property does not seem to do anything.

Could someone provide a small code snippet or point me to some good
documentation on this subject?

Thanks,

Frank


VB Crystal Report >> Changing PageHeader text object values at runtime

by William E Voorhees » Sun, 08 May 2005 10:01:09 GMT


In the code below, 'Company' is the name of the text object in my report.

This code that works for me:

Dim MyText As CrystalDecisions.CrystalReports.Engine.TextObject

MyText = CType(myreport.ReportDefinition.ReportObjects.Item("Company"), _

CrystalDecisions.CrystalReports.Engine.TextObject)

MyText.Text = "Any Text that you want"

HTH



Bill V









Similar Threads

1. Change Text Value on Runtime

Hi all,
 i have trouble with changing text value of textbox on runtime. I use this 
control to display process information about sending e-mail per smtp. I use 
external component

>>Imports devBiz.Net.Mail

 which can hadle events by sending mail.

>>AddHandler client.OnProgress, AddressOf Progress

I have function, which can calculate status of process in percent

>>Public Sub Progress(ByVal sender As Object, ByVal e As ProgressEventArgs)
>> Dim percent As Integer = _
 >> CType((CType(e.Position / e.Length * 100, Double)), Integer)
 >> txtMailStatus.Text = percent
>>End Sub

Progress Function is called every time, when sending status  is changed, 
function calculates correctly 'percent' value, but on form i cannot change 
default text. Can you anybody help me? Below i attached all source code for 
this form.

I have no onLoad Function for this form defined. Is it problem? How can I 
changed text value of text box on runtime?

Than you for your help
Radek Budar

Imports System.Text

Imports devBiz.Net.Mail

Public Class frmRegistrationRequest

Dim frmMailStatusForm as New frmMailSendingStatus

Private Sub sendRequest( ByVal sender As System.Object, ByVal e As 
System.EventArgs) _

Handles btnSendRegReq.Click


Dim strPrijmeni as String

Dim strJmeno as String

Dim strMesto as String

Dim strEmail as String

Dim sql as String

Dim firstRun as Date

Dim regNrUser as Double


Dim mailMsg As MailMessage = New MailMessage

mailMsg.From.EMail = " XXXX@XXXXX.COM "

mailMsg.To.Add("XXX"," XXXX@XXXXX.COM ")

Dim now as Date

strPrijmeni = txtPrijmeni.Text

strJmeno = txtJmeno.Text

strMesto = txtMesto.Text

strEmail = txtEmail.Text

Dim sb As New StringBuilder()

sb.Append(strPrijmeni)

sb.Append(",")

sb.Append(strJmeno)

sb.Append(",")

sb.Append(strMesto)

sb.Append(",")

sb.Append(strEmail)

sb.Append(",")

sb.Append(regNrUser)


mailMsg.Subject = "test - " & now

mailMsg.Body = sb.ToString

Dim client As smtp = New smtp

client.Host = "smtp.seznam.cz"

client.Port = 25

' We will capture the progress event, so we attach an event handler

AddHandler client.OnProgress, AddressOf Progress


txtMailStatus.Visible = True

'E-mail sending

Try

client.SendMessage(mailMsg)

Catch ex As System.Net.Mail.SmtpException

txtMailStatus.ForeColor = Color.Red

txtMailStatus.Text = "Failure!"

MsgBox("Odesle-mailu se nezdalo, zkontrolujte ppojenk internetu!" 
& vbNewLine & vbNewLine + ex.Message, MsgBoxStyle.Exclamation, "Chyba p 
odesregistrao e-mailu")

Exit Sub

Finally

End Try


txtMailStatus.ForeColor = Color.Green

txtMailStatus.text = "Done...success!"


stavRegistrace = 3

Me.Close

End Sub



Public Sub Progress(ByVal sender As Object, ByVal e As ProgressEventArgs)

Dim percent As Integer = _

CType((CType(e.Position / e.Length * 100, Double)), Integer)

txtMailStatus.Text = percent

End Sub

End Class


2. Catching changes in pageheader/pagefoot - Word VBA

3. Change the numeric value of a dropdown to text value

I'm trying to email the values of form fields that I have created in a
form.  So basically what I want to do is in the Subject I want to take
the "value" of the dropdown called dropdown1 and put it in the
subject.  It is working but it is putting the numeric value instead of
the text value.  How do I convert it.

Thanks much!

4. Change value of checkbox at runtime (using VBA)