Showing posts with label textbox. Show all posts
Showing posts with label textbox. Show all posts

Friday, March 23, 2012

How to change fontweight for different parts of text in textbox

I'm trying to change the fontweight for different parts of text in a textbox, but it seems that the fontweight applies only to the textbox as a whole. Below is what I want to do, how can I get this to work?

I have a textbox inside a rectangle that is the same width of the rectangle, the text align is centered. The expression of the textbox is:

="Date from: " & Parameters!DateFrom.Value & " Date to: " & Parameters!DateTo.Value

I would like "Date from:" and "Date to:" to be Normal weight and "Parameters!DateFrom.Value" and "Parameters!DateTo.Value" to be Bold weight.

This whole line needs to be centered in the rectangle, I thought about breaking the line up into multiple textboxes using text alignments right and left, but that will not work for lines where I don't know how long the length of the value will be. Any help would be appreciated...

Thanks!

Hi,

I doubt if there is any workaround available for this except for breaking the line into multiple textboxes . This is what I had done to format parts of text differently.

Regards,

Ashish

Monday, March 12, 2012

How to capture the only "time" into the database

I've a textbox that displays the current time in this format "hh:mm:ss tt" but when it is save into the database it'll display the date and time together. So how do I save only the time into the database? My codes is as shown below:

txtTime.Text = DateTime.Now.ToLongTimeString()

Dim

parameterDateAs SqlParameter =New SqlParameter("@.Date_5",SqlDbType.DateTime)

parameterDate.Value = txtDate.Text

objCommand.Parameters.Add(parameterDate)

I've tried using Format() but it still get the same results. Can someone help me out? Thanks!

The SQL Datetime datatype will always store a date portion. as effectively all you are doing is storing a time difference since an initial base date/time.

Perhaps change your SQL datatype to varchar and store the time as a string, or else use a constant date along with your time value (IE 1/1/1900).

Dave

Friday, March 9, 2012

How to call ReportViewer Refresh method?

I have a web form with a textbox that contains a parameter for a report defined in the ReportViewer control. I want to refresh the report when the user clicks on my refresh button. I can't find the Refresh method. It works if I click on the reviewer's refresh button, but my users need to see that big button that says Refresh. Any ideas of how to call the refresh method? ThanksFound it.

Me.ReportViewer1.LocalReport.Refresh()

Sunday, February 19, 2012

How to build an expression for a textbox?

Can I build an expression on a textbox with a "Sql Select" statement based
on the dataset? There is a parameter user selected on the dropdown and it
generates a dataset from the store procedure. This parameter is used on a
subquery for this dataset in the store procedure and it will return with the
records containing other parameter IDs. However I need to assign a record on
a textbox and require to filter out the record with the same parameterID
user selected in the dropdown. Thanks.
Eg. Parameters!Person.Value=2 selected in the dropdown
Recordset: SearchName
PersonID LName FName
1 Doe John
2 Doe Peter
3 Doe Jane
I need to assign the the name Doe, Peter on a textbox.If I understand correctly, you just want to use the data from the result set
that is returned from the data set.
If you go to the text box where you want to add the expression, right-click
that box, and click on the 'Expression' option.
In the Expression builder you can click the expansion (+) button next to
Fields, then select the Last Name, and click the insert button. Then in the
expression box, type a string that would add a comma, then finish by adding
the first name field to the expression box.
The result in the Expression box would look something like:
=Fields!LName.Value + ", " + Fields!FName.Value
Give that a try and see what happens.
"Paul" wrote:
> Can I build an expression on a textbox with a "Sql Select" statement based
> on the dataset? There is a parameter user selected on the dropdown and it
> generates a dataset from the store procedure. This parameter is used on a
> subquery for this dataset in the store procedure and it will return with the
> records containing other parameter IDs. However I need to assign a record on
> a textbox and require to filter out the record with the same parameterID
> user selected in the dropdown. Thanks.
> Eg. Parameters!Person.Value=2 selected in the dropdown
> Recordset: SearchName
> PersonID LName FName
> 1 Doe John
> 2 Doe Peter
> 3 Doe Jane
> I need to assign the the name Doe, Peter on a textbox.
>
>