New Member FAQ | Forums | Earn Revenue


Resources Entrance Ask Experts Exam Papers Jobs English Projects Universities Colleges Courses Schools Training My India



My Profile
Active Members
TodayLast 7 Days more...



Awards & Gifts
Online Exams

Fresher Jobs


Our fresher job section is exclusively for fresh graduates! Find jobs for freshers in major Indian cities including Bangalore, Chennai, Hyderabad, Pune or Kochi

Resources


Find educational articles, blogs, discussion threads and other resources.

Colleges


Find details about any college in India or search for courses.

website counter



Dynamic controls through SQL Server using VB.Net


Posted Date:     Total Responses: 0    Posted By: UltimateRengan   Member Level: Gold   Points/Cash: 4   


You can create the Dynamic controls through SQL Server using VB.Net.
For Example
First you create the table createtextbox its have two field name label(nchar(10)),textbox(numeric(18, 0)).
You just drag and drop the Panel control from toolbox and place it on form.
Then you put the below code and excute it.

Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports System.Data.SqlClient
Public Class Form1
Dim con As SqlClient.SqlConnection
Dim cmd As SqlClient.SqlCommand
Dim rd As SqlClient.SqlDataReader
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
con = New SqlClient.SqlConnection("Data Source=xxxxx;Initial Catalog=Emp;Integrated Security=True")
con.Open()
cmd = New SqlCommand("select label,textbox from createtextbox", con)
rd = cmd.ExecuteReader()

While (rd.Read())
Dim b As String
b = rd.Item("textbox").ToString
Dim y As Integer
y = Convert.ToInt32(b)
Dim i As Integer
For i = 1 To y
Dim l As New Label
l.Location = New Point(50, y)
y = y + 32
Panel1.Controls.Add(l)
'me.Controls.Add(l)


l.Text = rd.Item("label").ToString()
Dim x As Integer
Dim t As New TextBox
Dim j As Integer
x = Convert.ToInt32(b)
For j = 1 To x
t.Location = New Point(150, x)
x = x + 31
Panel1.Controls.Add(t)
'me.Controls.Add(t)
Next
Next
' rd.Close()
'con.Close()
End While


End Sub
End Class




Project Feedbacks


No feedbacks found. Be the first to respond and make money from revenue sharing program.

Post Feedback
You must Sign In to post a feedback.
Next Project: Create Controls using Placeholder in ASP.Net
Previous Project: Count number of tables on a page in javascript

Return to Project Index

Post New Project


Related Projects



Advertise Here





Contact Us   Advertise   Editors    Privacy Policy    Terms Of Use   

ISC Technologies.
2006 - 2009 All Rights Reserved.