PC Review


Reply
Thread Tools Rate Thread

Display database field as part of string in a label control

 
 
=?Utf-8?B?aWxy?=
Guest
Posts: n/a
 
      12th Jan 2005
Hi

Hope someone can help me with a bit of a newbie question.

I want to diplay a field from the last row of a table as part of a string in
a label control and would like to know the best way of doing it.

Most of the posts or books I've read are directed towards binding controls
or datagrids to datasets and I can do this ok. What I am having trouble with
is selecting a single field and adding that field to the text string to be
added to the label control.

eg. the text string might be something like this "the result is <field>"

Appreciate any assistance.




 
Reply With Quote
 
 
 
 
W.G. Ryan eMVP
Guest
Posts: n/a
 
      12th Jan 2005
What you may want to do is use an Expression Column
http://www.knowdotnet.com/articles/dataviews1.html

What you can do is create another column of type String, then set its
expression to "'the result is + ColumnName"; and just bind to that column
instead.

If this won't work, let me know.

Cheers,

bill

--
W.G. Ryan MVP (Windows Embedded)

TiBA Solutions
www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"ilr" <(E-Mail Removed)> wrote in message
news:5A99CE8A-AC6F-497F-BD11-(E-Mail Removed)...
> Hi
>
> Hope someone can help me with a bit of a newbie question.
>
> I want to diplay a field from the last row of a table as part of a string

in
> a label control and would like to know the best way of doing it.
>
> Most of the posts or books I've read are directed towards binding controls
> or datagrids to datasets and I can do this ok. What I am having trouble

with
> is selecting a single field and adding that field to the text string to be
> added to the label control.
>
> eg. the text string might be something like this "the result is <field>"
>
> Appreciate any assistance.
>
>
>
>



 
Reply With Quote
 
Sahil Malik
Guest
Posts: n/a
 
      12th Jan 2005
ilr,

As bill suggested, you can certainly get the column value to look like "the
result is <field>" using an expression'ed column.

However, do you need it to not appear in a datagrid .. instead appear it on
... say labels or textboxes .. with back next buttons? Is that what you are
trying to acheive? .. If so, you'd just have to bind it differently .. let
me know if that is what you are trying to acheive.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik


"ilr" <(E-Mail Removed)> wrote in message
news:5A99CE8A-AC6F-497F-BD11-(E-Mail Removed)...
> Hi
>
> Hope someone can help me with a bit of a newbie question.
>
> I want to diplay a field from the last row of a table as part of a string
> in
> a label control and would like to know the best way of doing it.
>
> Most of the posts or books I've read are directed towards binding controls
> or datagrids to datasets and I can do this ok. What I am having trouble
> with
> is selecting a single field and adding that field to the text string to be
> added to the label control.
>
> eg. the text string might be something like this "the result is <field>"
>
> Appreciate any assistance.
>
>
>
>



 
Reply With Quote
 
=?Utf-8?B?aWxy?=
Guest
Posts: n/a
 
      12th Jan 2005
Thanks Bill

I'll work through the example and see how I go (I use vb but should be able
to get the gist). I'll let you know how I go.

Regards
Ian


"W.G. Ryan eMVP" wrote:

> What you may want to do is use an Expression Column
> http://www.knowdotnet.com/articles/dataviews1.html
>
> What you can do is create another column of type String, then set its
> expression to "'the result is + ColumnName"; and just bind to that column
> instead.
>
> If this won't work, let me know.
>
> Cheers,
>
> bill
>
> --
> W.G. Ryan MVP (Windows Embedded)
>
> TiBA Solutions
> www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
> "ilr" <(E-Mail Removed)> wrote in message
> news:5A99CE8A-AC6F-497F-BD11-(E-Mail Removed)...
> > Hi
> >
> > Hope someone can help me with a bit of a newbie question.
> >
> > I want to diplay a field from the last row of a table as part of a string

> in
> > a label control and would like to know the best way of doing it.
> >
> > Most of the posts or books I've read are directed towards binding controls
> > or datagrids to datasets and I can do this ok. What I am having trouble

> with
> > is selecting a single field and adding that field to the text string to be
> > added to the label control.
> >
> > eg. the text string might be something like this "the result is <field>"
> >
> > Appreciate any assistance.
> >
> >
> >
> >

>
>
>

 
Reply With Quote
 
=?Utf-8?B?aWxy?=
Guest
Posts: n/a
 
      12th Jan 2005
Thanks for your reply Sahil

I think the suggestion bill made is what I need. I don't need navigation
buttons in this example. It is just a static label that requires data from
the table to be displayed as part of a string when the form is loaded. I
don't have a datagrid but have a dataset that displays in a graph.

I'll give it a go and let you know

Ian




"Sahil Malik" wrote:

> ilr,
>
> As bill suggested, you can certainly get the column value to look like "the
> result is <field>" using an expression'ed column.
>
> However, do you need it to not appear in a datagrid .. instead appear it on
> ... say labels or textboxes .. with back next buttons? Is that what you are
> trying to acheive? .. If so, you'd just have to bind it differently .. let
> me know if that is what you are trying to acheive.
>
> - Sahil Malik
> http://dotnetjunkies.com/weblog/sahilmalik
>
>
> "ilr" <(E-Mail Removed)> wrote in message
> news:5A99CE8A-AC6F-497F-BD11-(E-Mail Removed)...
> > Hi
> >
> > Hope someone can help me with a bit of a newbie question.
> >
> > I want to diplay a field from the last row of a table as part of a string
> > in
> > a label control and would like to know the best way of doing it.
> >
> > Most of the posts or books I've read are directed towards binding controls
> > or datagrids to datasets and I can do this ok. What I am having trouble
> > with
> > is selecting a single field and adding that field to the text string to be
> > added to the label control.
> >
> > eg. the text string might be something like this "the result is <field>"
> >
> > Appreciate any assistance.
> >
> >
> >
> >

>
>
>

 
Reply With Quote
 
Sahil Malik
Guest
Posts: n/a
 
      13th Jan 2005
Oh great .. then it might work for you

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik


"ilr" <(E-Mail Removed)> wrote in message
news:336416ED-DCE3-4AD0-8CE6-(E-Mail Removed)...
> Thanks for your reply Sahil
>
> I think the suggestion bill made is what I need. I don't need navigation
> buttons in this example. It is just a static label that requires data
> from
> the table to be displayed as part of a string when the form is loaded. I
> don't have a datagrid but have a dataset that displays in a graph.
>
> I'll give it a go and let you know
>
> Ian
>
>
>
>
> "Sahil Malik" wrote:
>
>> ilr,
>>
>> As bill suggested, you can certainly get the column value to look like
>> "the
>> result is <field>" using an expression'ed column.
>>
>> However, do you need it to not appear in a datagrid .. instead appear it
>> on
>> ... say labels or textboxes .. with back next buttons? Is that what you
>> are
>> trying to acheive? .. If so, you'd just have to bind it differently ..
>> let
>> me know if that is what you are trying to acheive.
>>
>> - Sahil Malik
>> http://dotnetjunkies.com/weblog/sahilmalik
>>
>>
>> "ilr" <(E-Mail Removed)> wrote in message
>> news:5A99CE8A-AC6F-497F-BD11-(E-Mail Removed)...
>> > Hi
>> >
>> > Hope someone can help me with a bit of a newbie question.
>> >
>> > I want to diplay a field from the last row of a table as part of a
>> > string
>> > in
>> > a label control and would like to know the best way of doing it.
>> >
>> > Most of the posts or books I've read are directed towards binding
>> > controls
>> > or datagrids to datasets and I can do this ok. What I am having
>> > trouble
>> > with
>> > is selecting a single field and adding that field to the text string to
>> > be
>> > added to the label control.
>> >
>> > eg. the text string might be something like this "the result is
>> > <field>"
>> >
>> > Appreciate any assistance.
>> >
>> >
>> >
>> >

>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
display part of a text string Mark McCoy Microsoft Access Queries 1 4th May 2007 04:10 AM
Selecting field from table where field is part of a string =?Utf-8?B?cmM1MXd2?= Microsoft Access Form Coding 4 14th Feb 2006 10:29 PM
Remove time part from datetime in bound label control aaa@bbb.hr Microsoft C# .NET 1 5th Sep 2004 01:40 AM
Extract part of string in Field garethg Microsoft Access 1 12th Nov 2003 01:51 PM
RE: How to control tab spaces in a string on a Label control Xin Yan Microsoft Dot NET Compact Framework 1 11th Jul 2003 02:26 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:26 PM.