If you want to disable editing in Combo Box Control and if you just want user to select one of options then You just need to set,
Combobox_1.DropDownStyle = DropDownList
You can do this in designer also.
Its very Simple!
To read contents of rich text box we simply use an method called “Lines” of Rich Text Box Control
For Each str as String in RichTextBox1.Lines
Thats all folks!
This Small Code Helps us to Rename file in the Folder… Be Carefull with it..
If Directory.Exists(TextBox1.Text) Then If Not TextBox2.Text = "" Then Dim str As String Dim ct As Integer ct = 0 Try For Each element As String In Directory.GetFiles(TextBox1.Text) ListBox1.Items.Add(element) str = TextBox1.Text & "\" & TextBox2.Text & " " & ct & ".jpg" File.Move(element, str) ct += 1 Next Catch ex As Exception MsgBox(ex.ToString) End Try For Each element As String In Directory.GetFiles(TextBox1.Text) ListBox2.Items.Add(element) Next Else MsgBox("Value Missing") End If Else MsgBox("Directory Not Found") End If
Textbox1 gets the folder name and More >
This is one of exciting feature in Microsoft SQL Server. This feature has been introduced only after SQL Server 2005. It is used to Expose our Database over HTTP so that each and every time we dont need to connect directly to database. We just need to send query to web service and then it takes care of all other stuffs…
Syntax for creating SQL Endpoint is
CREATE ENDPOINT sql_endpoint STATE = STARTED AS HTTP( PATH = '/findurcodes', AUTHENTICATION = (INTEGRATED ), PORTS = ( CLEAR ), SITE = 'SERVER' ) FOR SOAP ( WEBMETHOD 'GetMethodName' (name='dbo.xp_msver', SCHEMA=STANDARD
The Primary key of a relational table should uniquely identify each record in the table. These Keys contains only Unique Values and cannot be Null. It Ensures only Unique Values by which we can easily get a record in table.
Each Table can have only one primary key but can have many unique keys. (Candidate Columns) Syntax for Creating Primary key is,
CREATE TABLE EMP ( E_Id int NOT NULL PRIMARY KEY, L_Name varchar(255) NOT NULL, F_Name varchar(255), )
To Insert Primary key in a table,
ALTER TABLE EMP ADD CONSTRAINT pk_ID PRIMARY KEY (E_Id,L_Name)
To Drop a Primary More >
SQL’s TOP Keyword is specified in query to return only selected number of rows. When the Result set has more records, like if it has more than 1000 records, the query execution time will be more… In that time if we need only first few records instead of whole result set, then we can use this keyword to optimize our Query.
SELECT TOP [number|percent] column_name FROM table_name
SELECT TOP 2 FROM EMP
This will give only first 2 records from Emp Table.
In this post i will show you a simple way to establish datarelation between datatables in a dataset and then binding it in datagrid…
Well lets start with two tables, Tab Name Col1 Col2 Col3 Tab1 ID Name Tab2 ID Dept SAL
In Visual studio, We start by adding a datagrid in windows form..
Then, Dim cons As New String("Data Source=xxxx\SQLEXPRESS;Initial Catalog=emp;Integrated Security=True") 'Create Connection string... Dim sql1 As New String("Select * from tab1") Dim sql2 As New String("Select * from tab2") Dim sql As New String(sql1 & " ; " & sql2) 'Two queries or else we
Well first problem that i had after upgrading is that i lost my shortcut of “devenv” which should open vs 2010 but it opened vs 2008…. as the executables of both versions are same, we either need to change the Command Text of Devenv or we have to do a small edit in registry path…
First type “regedit” in rum command and press enter.. then navigate to below path.
Now double click the value on right side and change from
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe
Thats it More >
Here i will show a simplest way to bind data to a combo box retrieved from database. To put it simple, First we need to get Tables from Database, then we can bind particular columns value to combo box.
Here is how we bind data to combo box in .net
connetionString = "Data Source=<server_name>;Initial Catalog=<DB_name>;Integrated Security=True" cnn = New SqlConnection(connetionString) ad = New SqlDataAdapter("Select * from Table", cnn) ad.Fill(ds, "col_name") ComboBox1.DataSource = ds.Tables(0) ComboBox1.DisplayMember = "Table1.Col_name" ComboBox1.ValueMember = "Col_name"