473,756 Members | 7,817 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

seshu
156 New Member
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 1492
hariharanmca
1,977 Top Contributor
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 New Member
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 Top Contributor
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 Top Contributor
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 New Member
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 Top Contributor
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 New Member
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 New Member
iam really sorry i found the anser it should be groupbox1.contr oles 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
6359
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 didn't work. I discovered that this seemed to work: HTMLDocument.prototype.write= my_doc_write ; Why does HTMLDocument work here but not Document? Will this second
6
2866
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 loop through all the forms in a database and pull information about the form (controls and properties). We would need to do the same in our VB.NET project; loop through the project and get the web form's control and property information...
5
3130
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... except (for example) a = b + 10; needs to be a = b + (Angle) 10; Could some kind soul comment on my code and show me how it could be
3
8844
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 doing. Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click ** Response.Write("<!-- Include File='Example.aspx' -->")
4
5647
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 see in the code i CAN write it to the screen, but not to a string... Any ideas? (I'm not an expert in c++ so please keep it as simple as possible :p) thanks,
10
5331
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 for such a thing.
2
2910
by: drea | last post by:
Array_A 9 2 0 56 3 70 18 21 22
8
2984
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 the big changes I want to make is event-driven code (rather than the linear flow I had in Java). I have spent a week or so searching Google, talking to a couple of programming friends, and just chewing on it in my brain. I think I have an ok handle...
65
5089
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 got errors of Failed to open file ./outdir/mytestout.txt. Below is the code: #include <stdio.h>
0
9456
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
9275
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
9873
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
9846
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
8713
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...
1
7248
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5142
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3359
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2666
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.