0% found this document useful (0 votes)
4 views9 pages

VB

The document contains code for a Windows Forms application that manages player data using a SQL database, including functionalities for inserting, updating, deleting, and displaying player information. Additionally, it includes HTML templates for a restaurant and real estate website, outlining the structure for various pages such as home, menu, properties, and contact. Lastly, there is a Java applet that draws nested rectangles in different colors and displays the text 'Welcome' inside the innermost rectangle.

Uploaded by

PRINCY ANGHAN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views9 pages

VB

The document contains code for a Windows Forms application that manages player data using a SQL database, including functionalities for inserting, updating, deleting, and displaying player information. Additionally, it includes HTML templates for a restaurant and real estate website, outlining the structure for various pages such as home, menu, properties, and contact. Lastly, there is a Java applet that draws nested rectangles in different colors and displays the text 'Welcome' inside the innermost rectangle.

Uploaded by

PRINCY ANGHAN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Imports System.Data.

SqlClient

Public Class Form1

Dim connectionString As String = "Data Source=YourServer;Initial


Catalog=YourDatabase;Integrated Security=True"

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load


RefreshData()
End Sub

Private Sub RefreshData()


Dim query As String = "SELECT * FROM players ORDER BY country"
Using connection As New SqlConnection(connectionString)
Using command As New SqlCommand(query, connection)
connection.Open()
Dim adapter As New SqlDataAdapter(command)
Dim dataTable As New DataTable()
adapter.Fill(dataTable)
DataGridView1.DataSource = dataTable
End Using
End Using
End Sub

Private Sub ClearFields()


txtName.Clear()
txtCountry.Clear()
txtMatches.Clear()
txtRuns.Clear()
End Sub

Private Sub btnInsert_Click(sender As Object, e As EventArgs) Handles btnInsert.Click


Dim query As String = "INSERT INTO players (name, country, [no. of matches], [no of
runs]) VALUES (@name, @country, @matches, @runs)"
Using connection As New SqlConnection(connectionString)
Using command As New SqlCommand(query, connection)
connection.Open()
command.Parameters.AddWithValue("@name", txtName.Text)
command.Parameters.AddWithValue("@country", txtCountry.Text)
command.Parameters.AddWithValue("@matches", Convert.ToInt32(txtMatches.Text))
command.Parameters.AddWithValue("@runs", Convert.ToInt32(txtRuns.Text))
command.ExecuteNonQuery()
End Using
End Using
RefreshData()
ClearFields()
End Sub

Private Sub btnUpdate_Click(sender As Object, e As EventArgs) Handles btnUpdate.Click


Dim query As String = "UPDATE players SET name=@name, [no. of
matches]=@matches, [no of runs]=@runs WHERE country=@country"
Using connection As New SqlConnection(connectionString)
Using command As New SqlCommand(query, connection)
connection.Open()
command.Parameters.AddWithValue("@name", txtName.Text)
command.Parameters.AddWithValue("@matches", Convert.ToInt32(txtMatches.Text))
command.Parameters.AddWithValue("@runs", Convert.ToInt32(txtRuns.Text))
command.Parameters.AddWithValue("@country", txtCountry.Text)
command.ExecuteNonQuery()
End Using
End Using
RefreshData()
ClearFields()
End Sub

Private Sub btnDelete_Click(sender As Object, e As EventArgs) Handles btnDelete.Click


Dim query As String = "DELETE FROM players WHERE country=@country"
Using connection As New SqlConnection(connectionString)
Using command As New SqlCommand(query, connection)
connection.Open()
command.Parameters.AddWithValue("@country", txtCountry.Text)
command.ExecuteNonQuery()
End Using End Using RefreshData() ClearFields() End Sub

Private Sub btnDisplayByCountry_Click(sender As Object, e As EventArgs) Handles


btnDisplayByCountry.Click
Dim query As String = "SELECT * FROM players WHERE country=@country ORDER BY
name"
Using connection As New SqlConnection(connectionString)
Using command As New SqlCommand(query, connection)
command.Parameters.AddWithValue("@country", txtCountry.Text)
connection.Open()
Dim adapter As New SqlDataAdapter(command)
Dim dataTable As New DataTable()
adapter.Fill(dataTable)
DataGridView1.DataSource = dataTable
End Using
End Using End Sub End Class
restaurant website design <!-- index.html (Home Page) -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Restaurant Home</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>
<h1>Welcome to Our Restaurant</h1>
<nav>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="menu.html">Menu</a></li>
<li><a href="special_offers.html">Special Offers</a></li>
<li><a href="order.html">Order Online</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</nav>
</header>
<main>
<!-- Home Page Content -->
<p>Welcome to our restaurant website. Explore our delicious menu and take advantage of
our special offers.</p>
</main>
<footer>
<p>&copy; 2024 Restaurant Name. All rights reserved.</p>
</footer>
</body>
</html>

<!-- menu.html (Menu Page) -->


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Menu</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>
<!-- Header Content -->
</header>
<main>
<!-- Menu Page Content -->
<h2>Our Menu</h2>
<p>View our delicious offerings below:</p>
<!-- Insert Menu Items Here -->
</main>
<footer>
<!-- Footer Content -->
</footer>
</body>
</html>

<!-- special_offers.html (Special Offers Page) -->


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Special Offers</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>
<!-- Header Content -->
</header>
<main>
<!-- Special Offers Page Content -->
<h2>Special Offers</h2>
<p>Check out our latest special offers:</p>
<!-- Insert Special Offers Here -->
</main>
<footer>
<!-- Footer Content -->
</footer>
</body>
</html>

<!-- order.html (Online Order Page) -->


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Order Online</title>
<link rel="stylesheet" href="styles.css">
<script src="script.js"></script>
</head>
<body>
<header>
<!-- Header Content -->
</header>
<main>
<!-- Online Order Page Content -->
<h2>Order Online</h2>
<form id="orderForm" onsubmit="return validateForm()">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required><br>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required><br>
<label for="phone">Phone:</label>
<input type="tel" id="phone" name="phone" required><br>
<!-- Additional Order Form Fields Here -->
<input type="submit" value="Place Order">
</form> </main> <footer>
<!-- Footer Content -->
</footer></body></html>

<!-- contact.html (Contact Page) -->


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Contact Us</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>
<!-- Header Content -->
</header>
<main> <!-- Contact Page Content --> <h2>Contact Us</h2> <p>Get in touch with
us:</p>
<!-- Insert Contact Information and Form Here --> </main><footer> <!-- Footer Content -->
</footer>
</body></html>
Real Estate website design <!-- index.html (Home Page) -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Real Estate</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>
<h1>Welcome to Real Estate</h1>
<nav>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="properties.html">Properties</a></li>
<li><a href="about.html">About Us</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</nav>
</header>
<main>
<!-- Home Page Content -->
<p>Welcome to our Real Estate website. Find your dream property here.</p>
</main>
<footer>
<p>&copy; 2024 Real Estate. All rights reserved.</p>
</footer>
</body>
</html>

<!-- properties.html (Properties Page) -->


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Properties</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>
<!-- Header Content -->
</header>
<main>
<!-- Properties Page Content -->
<h2>Properties</h2>
<p>Search properties by category:</p>
<ul>
<li><a href="property_details.html?category=bungalow">Bungalow</a></li>
<li><a href="property_details.html?category=row_house">Row House</a></li>
<li><a href="property_details.html?category=shop">Shop</a></li>
<li><a href="property_details.html?category=land">Land</a></li>
<!-- Add more categories as needed -->
</ul>
</main>
<footer>
<!-- Footer Content -->
</footer>
</body>
</html>

<!-- property_details.html (Property Details Page) -->


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Property Details</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>
<!-- Header Content -->
</header>
<main>
<!-- Property Details Page Content -->
<h2>Property Details</h2>
<p>Category: <span id="category"></span></p>
<!-- Display property details here -->
</main>
<footer>
<!-- Footer Content -->
</footer>
</body>
</html>

<!-- about.html (About Us Page) -->


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>About Us</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>
<!-- Header Content -->
</header>
<main>
<!-- About Us Page Content -->
<h2>About Us</h2>
<p>We are a leading real estate company providing excellent property services.</p>
</main>
<footer>
<!-- Footer Content -->
</footer>
</body>
</html>

<!-- contact.html (Contact Page) -->


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Contact Us</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>
<!-- Header Content -->
</header>
<main>
<!-- Contact Page Content -->
<h2>Contact Us</h2>
<p>Get in touch with us:</p>
<!-- Add contact form or information here -->
</main>
<footer>
<!-- Footer Content --> </footer></body></html>
import java.applet.*;
import java.awt.*;

public class RectangleApplet extends Applet {


public void paint(Graphics g) {
// Draw rectangle in different colors
g.setColor(Color.RED);
g.fillRect(50, 50, 200, 100);

g.setColor(Color.GREEN);
g.fillRect(70, 70, 160, 60);

g.setColor(Color.BLUE);
g.fillRect(90, 90, 120, 20);

// Print "Welcome" inside the rectangle


g.setColor(Color.WHITE);
g.setFont(new Font("Arial", Font.BOLD, 20));
g.drawString("Welcome", 110, 110);
}
}

You might also like