473,887 Members | 2,309 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multiple fields in a single textbox

My database stores City and State in two separate columns, but I want
to display them on my form as a single field. Since I'm a complete VB
novice, I'm not sure how to do this. I bind the data, and I can bring
each field into my forn as a separate textbox. I created a third
textbox, and added code in the Form_Paint routine to concatenate the
fields:

CityStateTextBo x.Text = CityTextBox.Tex t + ", " + StateTextBox.Te xt

This displayed just great, and the values were correct as I moved from
record to record with the PropertyBinding Navigator. I thought I could
just set the CityTextBox and StateTextBox to Visible = False in the
Properties window and I'd be done, but this causes the value in my
CityStateTextBo x to disappear as well.

I know there must be some way to access the data values themselves for
the current row, rather than pulling them from text boxes, but I'm not
knowledgeable enough to figure it out myself. Any suggestions?

May 12 '06 #1
7 7254
Yes, the data is coming from a dataset which is filled from an
Addresses database. I have an AddressesDatase t.xsd file in my project
which contains lines like

<Mapping SourceColumn="C ity" DataSetColumn=" City" />
<Mapping SourceColumn="S tate" DataSetColumn=" State" />

but I still don't know how to reference these in the Form code. Sorry
to be so ignorant; I'm not new to coding, but I am new to VB, and
trying to learn by doing. Thanks for your help.

May 12 '06 #2
rj
i also have this problem. what u can do (which is kinda corny, but it
works) is place a panel or label over the textboxes.
if you were using the oledataadapter to make the connection you could
also edit the select statement in the properties. this will bring up a
query window simillar to Ms Access query window and you could concat
the fields directly from there..

May 12 '06 #3
Spamicle.

The simplest (and best) way is creating that column while you are fetching
it using SQL.
An other method is to create an expression column.

http://www.vb-tips.com/default.aspx?...3-a3539697edbd

Dont be afraid for this sample, there is only something extra because it is
so simple.

Your expression is "FirstName + ' ' + LastName"

i hope this helps,

Cor

<sp********@gma il.com> schreef in bericht
news:11******** **************@ j73g2000cwa.goo glegroups.com.. .
My database stores City and State in two separate columns, but I want
to display them on my form as a single field. Since I'm a complete VB
novice, I'm not sure how to do this. I bind the data, and I can bring
each field into my forn as a separate textbox. I created a third
textbox, and added code in the Form_Paint routine to concatenate the
fields:

CityStateTextBo x.Text = CityTextBox.Tex t + ", " + StateTextBox.Te xt

This displayed just great, and the values were correct as I moved from
record to record with the PropertyBinding Navigator. I thought I could
just set the CityTextBox and StateTextBox to Visible = False in the
Properties window and I'd be done, but this causes the value in my
CityStateTextBo x to disappear as well.

I know there must be some way to access the data values themselves for
the current row, rather than pulling them from text boxes, but I'm not
knowledgeable enough to figure it out myself. Any suggestions?

May 12 '06 #4
That's a great suggestion, just cover up the "source" textboxes instead
of making them invisible. I played around with your idea, and I found
that if the "rollup" textbox is dragged onto the form after the
"source" textboxes, you can just make them all the same size and pile
them one on top of the other, and the textbox with the concatenated
data will be the one that displays. This doesn't require a panel or a
label, just cover them up with the textbox you want to display. The
only thing that seems to be required to make this work is dragging the
destination textbox onto the form after the source textboxes.

I don't have that oledataadapter in any form that I recognize. It
might be under the covers somewhere, but I don't see it. All I have is
"Me.Adapter "s in the Dataset.Designe r.vb, and I don't see any select
statement for my textboxes in the Properties panel. I still think
there must be a way to get the value of the fields directly, rather
than ferrying them through intermediate textboxes, but we seem to have
stumped the experts here.

May 12 '06 #5
rj
oh yes piling them on top of 1 another is also fine.
did you code the connection?
I dont know how to do it like that. if you add an "oledbdataadapt er" to
your form, you'll see it appear below the forms design.
right click it and select "configure data adapter"
follow the wizard.. you can concat that field you want in the wizards
select statement.
after that you create a dataset based on the table, and then link the
relevant textboxes in the items properties.

all the best!

May 12 '06 #6
Thanks, Cor and rj, your suggestions have enabled me to solve my
immediate problem and learn a little about how the data access pieces
all tie together in this development environment. I really appreciate
it.

May 12 '06 #7
Thanks, Cor and rj, your suggestions have enabled me to solve my
immediate problem and learn a little about how the data access pieces
all tie together in this development environment. I really appreciate
it.

May 12 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
4110
by: Drew | last post by:
I have a db table like the following, UID, int auto-increment RegNo Person Relation YearsKnown Now here is some sample data from this table,
11
4545
by: dskillingstad | last post by:
I've been struggling with this problem for some time and have tried multiple solutions with no luck. Let me start with, I'm a novice at Access and I'm not looking for someones help to design my database,just help in getting me pointed in the right direction. I have a database with 8 tables, which from what I have read, cannot be linked on a single form, and be updatable. I have created a query which includes all 8 tables, and then...
22
23395
by: Matthew Louden | last post by:
I want to know why C# doesnt support multiple inheritance? But why we can inherit multiple interfaces instead? I know this is the rule, but I dont understand why. Can anyone give me some concrete examples?
2
8853
by: .Net Newbie | last post by:
Hello, I am currently coding my ASP.Net pages in c# and have run into a question concerning Emails. I have four objects on a page (six including 2 buttons). The first is a subject line (textbox) , the next is the email body (a Textbox with multiple rows), an email address (textbox), and a DropDownList containing multiple email addresses (populated from a SQL Server table). The way this page functions is that a user types in the email...
12
3023
by: shank | last post by:
I'm trying to use online samples for submitting multiple records from ASP into a stored procedure. Failing! Through the below form, a user could be submitting many records at a time. I'm not getting any records inserted. For troubleshooting, I cut the form down to 1 textbox and when submitted it populated 5 rows of the same data. So I know I'm connected, but not getting the LOOP and NEXT correct? How do I set this up so many records can be...
2
2880
by: Matt | last post by:
Hi, I'm ridiculously new to Access (about a week!) so please be patient! My database is a record of British Standards. Each has a unique identifier. Some are split into parts. I would like the user to be able to input the data into a single textbox using a form like this: Record1: BS 1490-1 Record2: BS 1490-2
8
8166
by: JReneau35 | last post by:
I am a novice to MS Access. I have about 10 to 15 tables that link to a single form. I use unique ID's to link all of these tables together. Since the ID for the customer never changes, I was hoping that someone could give me a hand and let me know if it is possible to add/update multiple table fields with a single textbox in a form. Thanks, JReneau35
4
9823
4Him
by: 4Him | last post by:
First off, let me say this is a great site! I've just started working with Access and much of my success is from what I've read here! Background: I have a form, driven off a single table. Goal: To have multiple fields copied and pasted into multiple records with a single button click. Work Done: In the form I have multiple fields, but for my question let's just refer to FIELD 1 and FIELD 2. I would like to copy the value of FIELD 2 and...
4
3332
convexcube
by: convexcube | last post by:
Hi everyone, I am developing a database which amongst other things records contacts and related information. This database is structured so that a person can be an 'Employee', 'User', 'Customer' etc or any combination of those. So I have a Persons table, a Users table, an Employees table and a Customers table all related by Person_ID. Persons can also have multiple tags (such as Electrician, Plumber etc), so this is in a separate table also...
0
9957
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9799
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10771
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10877
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10434
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9593
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6011
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4239
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3245
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.