Form view question

If I use a form view component how do I referance that field in vb

example formview1  has a field called "name"  when I try to referance this field in the vb source. it tell me that name is not declared
jfgrayiiiAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jake072Commented:
I'm not sure I understand what you mean by "field"...  Do you mean Property?  If so, make sure it's accessible outside the class

Jake
jfgrayiiiAuthor Commented:
If I have a textbox out of a form view I can type

me.textbox1.text = "blah blah"

If that text box is used in a form view  or data grid

me.textbox1 will say not declared

jake072Commented:
me.parent.textbox1.text = "blah blah"

You have to refer to the parent of your control (the form), and then access it's controls.

Jake
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

jfgrayiiiAuthor Commented:
how would I referance a field from

sqldatasource1
 in
formview1 ?
jake072Commented:
You can set it when you create the FormView1...

For Instance, you could say (in FormView1):

Private SqlDataSource1 As SqlDataSource

Sub New(ByRef SqlDataSource1 As SqlDataSource)
    Me.SqlDataSource1 = SqlDataSource1
End Sub

Now you can access SqlDataSource1 from your FormView1.

Hope that helps,

Jake
jfgrayiiiAuthor Commented:
If I drop a text box on a form I can double click on that box and write vb code

example.

me.textbox1.text = "0"

If I insert a form view component right click on it, go to edit templete, and add a textbox and double click on it
me.textbox1.text does not work  it says textbox 1 not declared how do I declare a referance to textbox1 in a form view


 
jfgrayiiiAuthor Commented:
I am using visual studio 2005 btw
jake072Commented:
Ok...

What I would do is iterate through all of the controls on the form, and add them into the FormView...

private ctrl As Control()

For Each ctrl As Control In Me.Controls
    If ctrl Is Nothing Then
        ReDim ctrl(0)
    Else
        ReDim Preserve ctrl(ctrl.Length)
    End If
    ctrl(ctrl.Length -1) = ctrl
Next

Now, add the ctrl array to the FormView, and voila, you can access any controls in your form.

Let me know if you need more help.

Jake

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.