Monday, 22 February 2016
Monday, 15 February 2016
TextView in Android
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello"
/>
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello"
/>
Splash Screen in Android
Splash.xml
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/spalsh"
android:weightSum="1"
android:orientation="vertical" >
</LinearLayout>
Splash.Java
import java.io.File;
import java.io.IOException;
import android.content.Intent;
import android.content.res.AssetFileDescriptor;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
public class Splash extends ActionBarActivity {
private ActionBar ab;
MediaPlayer ourSong;
private static int SPLASH_TIME_OUT = 3000;
final MediaPlayer mp=new MediaPlayer();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash_screen);
ab = getSupportActionBar();
ab.hide();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent i = new Intent(Splash.this, MainActivity.class);
startActivity(i);
finish();
}
}, SPLASH_TIME_OUT);
}
}
How to Fill DataGridview in C#
s = "select * from tablename";
MySqlDataAdapter da = new MySqlDataAdapter(s, getcon());
DataTable dt = new DataTable();
da.Fill(dt);
dataGridView1.DataSource = dt;
MySqlDataAdapter da = new MySqlDataAdapter(s, getcon());
DataTable dt = new DataTable();
da.Fill(dt);
dataGridView1.DataSource = dt;
Auto Complete Text Box in C#
AutoCompleteStringCollection namesCollection = new AutoCompleteStringCollection();
void AutoCompleteItems()
{
try
{
AutoCompleteStringCollection namesCollection = new AutoCompleteStringCollection();
s = "Select EmpName from tablename ";
dt = cnn.DataTable(s);
if (dt.Rows.Count > 0)
{
for (int i = 0; i <= dt.Rows.Count - 1; i++)
{
namesCollection.Add(dt.Rows[i][0].ToString());
}
}
else
{
}
txt_empName.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
txt_empName.AutoCompleteSource = AutoCompleteSource.CustomSource;
txt_empName.AutoCompleteCustomSource = namesCollection;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
void AutoCompleteItems()
{
try
{
AutoCompleteStringCollection namesCollection = new AutoCompleteStringCollection();
s = "Select EmpName from tablename ";
dt = cnn.DataTable(s);
if (dt.Rows.Count > 0)
{
for (int i = 0; i <= dt.Rows.Count - 1; i++)
{
namesCollection.Add(dt.Rows[i][0].ToString());
}
}
else
{
}
txt_empName.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
txt_empName.AutoCompleteSource = AutoCompleteSource.CustomSource;
txt_empName.AutoCompleteCustomSource = namesCollection;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
Programatically Save an Image From a URL in C#
WebClient webClient = new WebClient();
webClient.DownloadFile(FileUrl, Location);
How to Fill ComboBox From Database in C#
s = "select * from tablename ";
MySqlDataAdapter da = new MySqlDataAdapter(s, getcon());
DataTable dt = new DataTable();
da.Fill(dt);
cmb_serchcategorie.DataSource = dt;
cmb_serchcategorie.ValueMember = "ID";
cmb_serchcategorie.DisplayMember = "ColumnName";
MySqlDataAdapter da = new MySqlDataAdapter(s, getcon());
DataTable dt = new DataTable();
da.Fill(dt);
cmb_serchcategorie.DataSource = dt;
cmb_serchcategorie.ValueMember = "ID";
cmb_serchcategorie.DisplayMember = "ColumnName";
What is Asp.net MVC ?
MVC stands for Model View Controller is a web application development framework mainly used for developing application in three layers like Data Layer also called Model, Presentation Layer also called View and Business Layer called as Controller.
We use MVC pattern to reduce complexity of code and provide seperation of codes.
Model is used as class it contains the Database entity logics and provides manupulation of data to write code here.
View is used as presentation layer .it presents the data in desired format that user wants to present.
Controller is collection of methods defined business logic of an application.
We use MVC pattern to reduce complexity of code and provide seperation of codes.
Model is used as class it contains the Database entity logics and provides manupulation of data to write code here.
View is used as presentation layer .it presents the data in desired format that user wants to present.
Controller is collection of methods defined business logic of an application.
Programmatically Set the ForeColor of a label in C#
lblExample.ForeColor = System.Drawing.Color.Red;
Difference Between Memory Stream and file Stream.
Serialization is a process of converting object into byte streams for storing Data in any Backing Device.
During the Serialization we can use either file stream or Memory stream.
Memory Stream is representation of data in byte stream format in memory because there is no any backing store for Byte stream . Memory Stream reduce the need for temporary buffers and files in an application. where as File stream is used for read data from disk or file .
a memory stream can be used to read data that is mapped in the computer's internal memory (RAM). You are basically reading/writing streams of bytes from memory.
There are two ways to create a MemoryStream.
You can initialize one from an unsigned byte array or we can create an empty one. Empty memory streams are resizable.
Advantage of a memory stream is that there is no need to create temporary bufers and files in an application.
File stream and memory stream both are classes in C# and it derives from System.IO namespace.
During the Serialization we can use either file stream or Memory stream.
Memory Stream is representation of data in byte stream format in memory because there is no any backing store for Byte stream . Memory Stream reduce the need for temporary buffers and files in an application. where as File stream is used for read data from disk or file .
a memory stream can be used to read data that is mapped in the computer's internal memory (RAM). You are basically reading/writing streams of bytes from memory.
There are two ways to create a MemoryStream.
You can initialize one from an unsigned byte array or we can create an empty one. Empty memory streams are resizable.
Advantage of a memory stream is that there is no need to create temporary bufers and files in an application.
File stream and memory stream both are classes in C# and it derives from System.IO namespace.
button Click Event In Android
login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
}
});
@Override
public void onClick(View view) {
}
});
Access Modifier in C#
Access Modifiers in C# :-access modifiers are used to define the scope of data and methods in the restricted manner. It protect data members of a class to outside interference.There are five types of access modifies in C# listed below:
(1). Public
(2).Private
(3). Protected
(4). Internal
(5). Protected internal Modifiers
(1) Public :- Public modifier allows public access to members both inside and outside the class.
(2) Private :- Private modifier allows the access of data members and member functions only inside the class in which they are declared , outside of class access is not allowed.
(3) Internal :- Internal modifier allows data access only to the current assembly , if a member is accessed outside the assembly in which it has been defined a error gets generated.
(4) Protected :- you can access the protected members inside the class in which they are declared or a class derived from that class in which they are declared.
(5) Protected Internal :- allows access to members containing in current assembly , containing class and the class derived from that class.
Subscribe to:
Posts (Atom)
