473,385 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Using Controls Collection

Hi
Im creating customer details form in VB.Net, in that Im getting
Original Details as well as Correspondance details of customer. If both
are same then by clicking checkbox all the text of respective fields
should be filled in correspondance details textboxes. I achieved some
what like this....

Try
Dim i, i1 As Control
Dim j As New TextBox

If CheckBox1.CheckState = CheckState.Checked Then
For Each i In TabControl1.TabPages(0).Controls
If TypeOf i Is TextBox Then
j = New TextBox
If Microsoft.VisualBasic.Mid(i.Name(), Len(i.Name()),
Len(i.Name())) = "1" Then
j.Name = (Microsoft.VisualBasic.Left(i.Name,
Len(i.Name) - 1)).ToString
'i1.Name = j
'i1.Text = "Testing"
i.Text = j.Text
'MsgBox(j.Text)
End If
End If
Next
End If
Catch ex As Exception
MsgBox(ex.Message)

But my problem is even I declared "j" as control, Im not getting j.text
as result, alternatively Im getting textboxes name but not textbox.text
values.. please anyone can help....

Nov 21 '05 #1
1 1135
Sivaprakash,

What you are doing now, is showing the text of a new textbox. That is for
sure empty.

Moreover, because that "Text" is a property of all controls, there is no
need to do any thing (casting or whatever) special for it.

You can just do (not complete your sample that is really to long to good
show the problem. Especially not because that you are using i and j which
are mostly used as standard names for indexers and not as controls)

for each ctr as control in mytabpage(0).controls
if TypeOff ctr is TextBox then
messagebox.show ctr.Text
end if
Next

I hope this helps,

Cor

<si********************@gmail.com> schreef in bericht
news:11**********************@f14g2000cwb.googlegr oups.com...
Hi
Im creating customer details form in VB.Net, in that Im getting
Original Details as well as Correspondance details of customer. If both
are same then by clicking checkbox all the text of respective fields
should be filled in correspondance details textboxes. I achieved some
what like this....

Try
Dim i, i1 As Control
Dim j As New TextBox

If CheckBox1.CheckState = CheckState.Checked Then
For Each i In TabControl1.TabPages(0).Controls
If TypeOf i Is TextBox Then
j = New TextBox
If Microsoft.VisualBasic.Mid(i.Name(), Len(i.Name()),
Len(i.Name())) = "1" Then
j.Name = (Microsoft.VisualBasic.Left(i.Name,
Len(i.Name) - 1)).ToString
'i1.Name = j
'i1.Text = "Testing"
i.Text = j.Text
'MsgBox(j.Text)
End If
End If
Next
End If
Catch ex As Exception
MsgBox(ex.Message)

But my problem is even I declared "j" as control, Im not getting j.text
as result, alternatively Im getting textboxes name but not textbox.text
values.. please anyone can help....

Nov 21 '05 #2

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

Similar topics

0
by: Sebastian Ferreyra | last post by:
Hi, I'm writng a control derived from UserControl (let's call this control MyControl) that itself is meant to be derived further times. MyControl hosts a public collection of specialized...
5
by: Mateo | last post by:
Let's say that I have panel control which is container control, and I need to access every child control inside panel control from JScript. I have this line of JS code: var oCollection =...
16
by: TD | last post by:
This is the code under a command button - Dim ctl As Control For Each ctl In Me.Controls If ctl.BackColor <> RGB(255, 255, 255) Then ctl.BackColor = RGB(255, 255, 255) End If Next ctl
1
by: msnews.microsoft.com | last post by:
I'm adding multiple web controls to the placeholder controls collection, but even when doing the for each and recursion method of getting the web controls, I'm only getting the first web control...
9
by: Merlin | last post by:
Hi, My code below doesn't work does anyone have any pointers? All my controls are programically added. Dim i As Int16 For i = 0 To Me.Controls.Count - 1 If Me.Controls(i).Name <>...
66
by: Cor | last post by:
Hi, I start a new thread about a discussion from yesterday (or for some of us this morning). It was a not so nice discussion about dynamically removing controls from a panel or what ever. It...
1
by: Tom McL. | last post by:
I have a program that I have added a tab control (using to following code) with 12 tabpages, on the pages I added AxMsChart and a Button. The button control works fine but the AxMsChart gives an...
53
by: Hexman | last post by:
Hello All, I'd like your comments on the code below. The sub does exactly what I want it to do but I don't feel that it is solid as all. It seems like I'm using some VB6 code, .Net2003 code,...
32
by: =?Utf-8?B?U2l2?= | last post by:
I have a form that I programmatically generate some check boxes and labels on. Later on when I want to draw the form with different data I want to clear the previously created items and then put...
9
by: dhtml | last post by:
I have written an article "Unsafe Names for HTML Form Controls". <URL: http://jibbering.com/faq/names/ > I would appreciate any reviews, technical or otherwise. Garrett --...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.