?
Solved

Form view question

Posted on 2006-04-04
9
Medium Priority
?
214 Views
Last Modified: 2011-10-03
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
0
Comment
Question by:jfgrayiii
  • 4
  • 4
8 Comments
 
LVL 14

Expert Comment

by:jake072
ID: 16371694
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
0
 

Author Comment

by:jfgrayiii
ID: 16371730
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

0
 
LVL 14

Expert Comment

by:jake072
ID: 16371750
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
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:jfgrayiii
ID: 16371792
how would I referance a field from

sqldatasource1
 in
formview1 ?
0
 
LVL 14

Expert Comment

by:jake072
ID: 16371820
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
0
 

Author Comment

by:jfgrayiii
ID: 16374717
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


 
0
 

Author Comment

by:jfgrayiii
ID: 16374722
I am using visual studio 2005 btw
0
 
LVL 14

Accepted Solution

by:
jake072 earned 2000 total points
ID: 16375116
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
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question