473,386 Members | 1,820 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,386 software developers and data experts.

I am able write a code in vb but not able to implement a similar in vb.net

seshu
156 100+
hi every body
This is seshu, here iam able write a code in vb6 on controle arrays ofcourse while designing it self i made my controls as arrays but here in .net i dint find that option see the code in vb6 is like this

Expand|Select|Wrap|Line Numbers
  1. Dim cont
  2. For Each cont In form
  3.     If TypeName(cont) = "TextBox" Then cont.Text = ""
  4. Next
and the code in vb.net is like this

Expand|Select|Wrap|Line Numbers
  1.  Dim cont As Form1.Controls
  2.         For each cont in me.controls
  3.             If TypeName(cont(i)) = "TextBox" Then
  4.                 If cont.text = " " Then
  5.                     MsgBox("Please fill all the details")
  6.                 End If
  7.             End If
  8.         Next
please show me the mistake or write code and what i want here is on a button click it should check where all the textboxs are filled or not
thanking you
regards
seshu
Jan 10 '07 #1
8 1476
hariharanmca
1,977 1GB
hi every body
This is seshu, here iam able write a code in vb6 on controle arrays ofcourse while designing it self i made my controls as arrays but here in .net i dint find that option see the code in vb6 is like this

Expand|Select|Wrap|Line Numbers
  1. Dim cont
  2. For Each cont In form
  3.     If TypeName(cont) = "TextBox" Then cont.Text = ""
  4. Next
and the code in vb.net is like this

Expand|Select|Wrap|Line Numbers
  1.  Dim cont As Form1.Controls
  2.         For each cont in me.controls
  3.             If TypeName(cont(i)) = "TextBox" Then
  4.                 If cont.text = " " Then
  5.                     MsgBox("Please fill all the details")
  6.                 End If
  7.             End If
  8.         Next
please show me the mistake or write code and what i want here is on a button click it should check where all the textboxs are filled or not
thanking you
regards
seshu

You are not using i for any increment or decrement, then why you are using i

Just try this

Dim cont As controls
For each cont in me.controls
If TypeName(cont) = "TextBox" Then
If cont.text = " " Then MsgBox("Please fill all the details")
End If
Next
Jan 10 '07 #2
seshu
156 100+
hi hari
this is seshu i tried that but still it is not showing the massage box if i click on the button with out fill the text in textboxes i think u understood my problem i hope u com back with some anser or good idea becos it urgent to me
Thanking you
regards
seshu
Jan 10 '07 #3
hariharanmca
1,977 1GB
hi hari
this is seshu i tried that but still it is not showing the massage box if i click on the button with out fill the text in textboxes i think u understood my problem i hope u com back with some anser or good idea becos it urgent to me
Thanking you
regards
seshu

Yes, I Got it it's not me.controls
its me only

Dim cont As controls
For each cont in me ‘me.controls
If TypeName(cont) = "TextBox" Then
If cont.text = " " Then MsgBox("Please fill all the details")
End If
Next

If you got answer reply
Jan 10 '07 #4
hariharanmca
1,977 1GB
Yes, I Got it it's not me.controls
its me only

Dim cont As controls
For each cont in me ‘me.controls
If TypeName(cont) = "TextBox" Then
If cont.text = " " Then MsgBox("Please fill all the details")
End If
Next

If you got answer reply

i got answer

you are giving space cont.text = " "
it should be like cont.text = ""


Dim cont As controls
For each cont in me.controls
If TypeName(cont) = "TextBox" Then
If cont.text = "" Then MsgBox("Please fill all the details")
End If
Next
Jan 10 '07 #5
seshu
156 100+
thanks for your help this happens every time i dont have a habit of cheking small thing in hurry any how i think here after i will be even after them
any how thanks a lot
regards
seshu
Jan 10 '07 #6
hariharanmca
1,977 1GB
thanks for your help this happens every time i dont have a habit of cheking small thing in hurry any how i think here after i will be even after them
any how thanks a lot
regards
seshu

Its Ok elephant don’t know ants
Jan 10 '07 #7
seshu
156 100+
hi struck in the same place again this time i have implemented the same code in another form with a panel containing three group boxes and each group box containg the text boxes and ithink the code should be same thats the reason i wrote the same above code but its not work can any one say the reson why
regards
seshu
Jan 11 '07 #8
seshu
156 100+
iam really sorry i found the anser it should be groupbox1.controles insted of me.controles one more thing if there is any way to delete this whole query please do that sorry guys
regards
seshu
Jan 11 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: James Marshall | last post by:
I'm writing a library where I want to override document.write(), but for all document objects; thus, I want to put it in the prototype. I tried Document.prototype.write= my_doc_write ; but it...
6
by: ALthePal | last post by:
Hi, I'm not sure if we are able to or even how to loop through the web forms in a VB.NET project during design time. In MSAccess we are able to go through the database -> forms collection and...
5
by: Darren Grant | last post by:
Hi there, I've attempted to implement an Angle class. An Angle is a subset of an integer, where the range is [0,360). All other operations should be permitted. The code works, I think......
3
by: Jer425 | last post by:
Hello all, I'm trying to post to another page from asp.net and direct the user there. I've looked through the group and found a lot of information. The following code may work well for what I'm...
4
by: childtobe | last post by:
I want to write the time to a file. (to implement this in an other piece of code that i've writen) For some reason he gives me a C2064 error when i try to put the time into a string. As you can...
10
by: riva | last post by:
This is an interview question from: http://www.freshersworld.com/interview/technical_interview_C.htm Can You write a function similar to printf() ? I can only think using putchar() and casting...
2
by: drea | last post by:
Array_A 9 2 0 56 3 70 18 21 22
8
by: Brad Walton | last post by:
Hello. First post, but been doing a bit of reading here. I am working on a project in Java, but decided to switch over to C# after seeing some of the additional features I can get from C#. One of...
65
by: Hongyu | last post by:
Dear all: I am trying to write to a file with full directory name and file name specified (./outdir/mytestout.txt where . is the current directory) in C programming language and under Unix, but...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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.