How to Get the X and Y Point of TextBox in For Each Loop in VB.Net

How to Get the X and Y Point of TextBox in For Each Loop in VB.Net

This tutorial is all about How to Get the X and Y Point of the TextBox Using For Each Loop in VB.Net.
In this tutorial I will teach you how to get X/Y Point of a Textbox Using For Each Loop in VB.Net. This method is used to get the location of a specific Textbox and I used the Foreach Loop so that, you don’t need to specify the names of it. All you have to do, is to get it’s type.

What is Visual Basic’s purpose?

The third-generation programming language was created to aid developers in the creation of Windows applications. It has a programming environment that allows programmers to write code in.exe or executable files. They can also utilize it to create in-house front-end solutions for interacting with huge databases. Because the language allows for continuing changes, you can keep coding and revising your work as needed.

How to Export DataGridView to Excel... x
How to Export DataGridView to Excel In VB.Net | 2019 With Source Code

However, there are some limits to the Microsoft Visual Basic download. If you want to make applications that take a long time to process, this software isn’t for you. That implies you won’t be able to use VB to create games or large apps because the system’s graphic interface requires a lot of memory and space. Furthermore, the language is limited to Microsoft and does not support other operating systems.

What are the most important characteristics of Visual Basic?

Microsoft Visual Basic for Applications Download, unlike other programming languages, allows for speedier app creation. It has string processing capabilities and is compatible with C++, MFC, and F#. Multi-targeting and the Windows Presentation Framework are also supported by the system, allowing developers to create a variety of Windows apps, desktop tools, metro-style programs, and hardware drivers.

Let’s begin.
Open the Visual Basic, create a new Windows Form Application, drag the Textbox and Button you needed. Set up the Form just like this.
loactionform
After setting up the Form, double click the Button to fire the click event handler of it. Then, add the following code to the method created.

[vbnet]
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
‘LOOP THE CONTROL ON THE FORM OF CONTROLS
‘ME IS AN OBJECT THAT STANDS AS A FORM
‘CONTROLS ARE BASE CLASS WHICH ARE COMPONENT WITH VISUAL REPRESENTATION
For Each txt As System.Windows.Forms.Control In Me.Controls
‘SET THE TYPE OF THE CONTROL TO A TEXTBOX.
If txt.GetType Is GetType(TextBox) Then
‘GETTING THE LOCATION OF A SPECIFIC TEXTBOX AND WILL APPEAR INTO IT.
txt.Text = txt.Location.ToString
End If
Next
End Sub
[/vbnet]

Run your project and click the Button to start the code in the method.

Readers might read also:

Leave a Comment