Pages

C SHARP -


This code snippet will show you on how to create a simple xml file in Visual Studio 10 Beta 2.

Step 1: Add a namespace to your code behind System.Xml and System.Text
Step 2: In your event/method to create an xml file
//Create a path were to save the xml file
String path = Server.MapPath(@”FolderName\MyFileName.xml”);
//Instantiate an XmlWriterSettings
var xmlWrite = new XmlWriterSettings();
//And other Declaration
xmlWrite.Indent = true;
xmlWrite.OmitXmlDeclaration = true;
xmlWrite.Encoding = Encoding.ASCII;
//Then try to write a data in xml file
Using (var write = XmlWriter.Create(path,xmlWrite))
{
write.WriteComment(“This is a basic sample on how to create xml file”);
write.WriteStartElement(“Head”);
write.WriteStartElement(“Header”);
write.WriteStartAttribute(“Header”);
write.WriteValue(HeaderValue);
write.WriteEndAttribute();
write.WriteEndElement();
write.WriteStartElement(“Footer”);
write.WriteStartAttribute(“Footer”);
write.WriteValue(FooterValue);
write.WriteEndAttribute();
write.WriteEndElement();
write.Flush();
}
That’s it. This sample created on asp.net project.

Java Script - Magic title

Magic title for weblogs or any pages on the internet

Java Script - Stars moving in background

You can make your page like space, it's wonderful stars going and moving in you background


                                             with my best : Mohamed Basha

Java script - Neon Lights Text


Directions: Simply insert the below where you wish the text to appear:

C SHARP & V.B - How to Pass values to another Form

How to Pass values to another Form

Ok. Lets say you have 2 Forms. Form1 and Form2.

In Visual Basic 6 this is simple codes with 1 line only: Form2.text1.text = Form1.text1.text
Thats so Simple.
But in C# not 1 line code. I have 2 ways to get a text from Form1/Form2.

FIRST WAY:
1.) Goto Form1 then Double Click it. At the code type this.

public string CaptionText
{get {return textBox1.Text;}
set { textBox1.Text = value; }}
note: the value of your textbox1.text = sayre;
2.) Goto Form2 then Double click it. At the code type this.
// At your command button In Form2
private void button1_Click(object sender, EventArgs e)
{
Form1 sForm1 = new Form1();
textBox1.Text = sForm1.CaptionText;

}

SECOND WAY:

1.) Goto Form2 then Double click it. At the code type this.

public Form2(string sTEXT)
{
InitializeComponent();
textBox1.Text = sTEXT;
}
2.) Goto Form1 then Double click it. At the code type this.
//At your command button in Form1
private void button1_Click(object sender, EventArgs e)
{
Form2 sForm = new Form2(textBox1.Text);
sForm.Show();
}

c sharp - How to Get Date and Time Difference in C SHARP

I have example here on how to get the difference of date and time in C#.
Step: 1
Create a timer then set the interval to 10 and enabled to true.
Step: 2
Create 3 Label. Label1,Label2,Label3.
Step: 3
Create 2 Datepicker. Name it dtfrom and dtto.
Step: 4
Create a Button1
Then Copy this Code at your form:
private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
{label1.Text = dtfrom.Value.ToString();}
private void timer1_Tick(object sender, EventArgs e)
{label2.Text = string.Format("{0:G}", DateTime.Now);}
private void button1_Click(object sender, EventArgs e)
{
TimeSpan ts = new TimeSpan();
DateTime dt1,dt2 = new DateTime();
dt1 = dtfrom.Value;
dt2 = Convert.ToDateTime(label2.Text);
ts=dt1.Subtract(dt2);
label3.Text = ts.ToString(); //Answer
}

Share/Bookmark


                                                  WITH MY BEST: MOHAMED BASHA

C SHARP-Showing newest posts with label Progress Bar


In this code show you on how to use the progress bar with Insert command.

First Step:
OleDbConnection conn = new OleDbConnection();
conn.ConnectionString = "your connectionstring";
conn.Open();
int i;
int x = 1000; //insert 1000 rows
Bar.Maximum = x; //Bar ( Your progressbar)
for (i = 0; i < x; i++)
{
string sQL = "Insert Into table1" & _ "(empid,dates,username) values ('COLLADO','11/4/1982','Sayre')";
OleDbCommand cmd = new OleDbCommand(sQL, conn);
cmd.ExecuteNonQuery();
Bar.Value = Bar.Value + 1;
pr = Bar.Value;
pr1 = pr / x;
pr2 = pr1 * 100;
lblpercent.Text = pr2.ToString(); //show the percent in label
Application.DoEvents();
}
//Get the total row in the table
string sQL1 = "select * from table1";
OleDbCommand cmd1 = new OleDbCommand(sQL1, conn);
DataSet ds = new DataSet();
OleDbDataAdapter da = new OleDbDataAdapter(cmd1);
da.Fill(ds);
string ss = ds.Tables[0].Rows.Count.ToString();

                    WITM MY BEST: MOHAMED BASHA

sortable table


Directions: Simply download "sortabletable.zip",
 and refer to the html page inside.

Insert the following code in the HEAD section of your page:

<script type="text/javascript" src="sortable.js"></script>


Then, for the table you wish the sort, insert a "class" and "id" attribute inside its <table> tag:


java - image clock

Step 1: Insert the below into the <HEAD> section of your page
Step 2: Then, to display the clock, call this function where you wish the clock to be shown:
Step 3: But wait, don't forget the images! Download the image pack below and upload the images inside to
the same directory as your webpage:
 

c# : Console Application - Get list of running processes

Get list of running processes
it's a console application

code
static void Main(string[] args)
{
Console.WriteLine("ID:\tProcess name:");
Console.WriteLine("--\t------------");
foreach (System.Diagnostics.Process process in System.Diagnostics.Process.GetProcesses())
Console.WriteLine("{0}\t{1}", process.Id, process.ProcessName);
Console.Read();
}

c# - Image Processing

this is source code to "Image Processing"  to edit image

                                     download here

JAVA - Mouse Over Picker TO CHANGE YOUR BG COLOR

// IT'S SO VERY NICE .......... TRY IT


<center>

<a href="" onMouseOver="var bg=prompt('What color would you like?');document.bgColor=bg">Put your mouse over me!</a>

</center>


Share/Bookmark



java code-All-in-one search engine

this is code



Round About

Round About
Check out this very cool circling text cursor following Script.
 It will hover forever. OoooooOOoooh. And it only uses 1 step. *hugs script*
Place this in your <HEAD> tags:

<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Kurt Grigg (mohamedbasha44@gmail.com) -->
<!-- Begin
if (document.all) {
//Things you can alter
yourLogo = "JavaFile.com - All FREE!"; //Not less than 2 letters!
logoFont = "Arial";
logoColor = "000000";
//Nothing needs altering below!
yourLogo = yourLogo.split('');
L = yourLogo.length;
TrigSplit = 360 / L;
Sz = new Array()
logoWidth = 100;
logoHeight = -30;
ypos = 0;
xpos = 0;
step = 0.03;
currStep = 0;
document.write('<div id="outer" style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i = 0; i < L; i++) {
document.write('<div id="ie" style="position:absolute;top:0px;left:0px;'
+'width:10px;height:10px;font-family:'+logoFont+';font-size:12px;'
+'color:'+logoColor+';text-align:center">'+yourLogo[i]+'</div>');
}
document.write('</div></div>');
function Mouse() {
ypos = event.y;
xpos = event.x - 5;
}
document.onmousemove=Mouse;
function animateLogo() {
outer.style.pixelTop = document.body.scrollTop;
for (i = 0; i < L; i++) {
ie[i].style.top = ypos + logoHeight * Math.sin(currStep + i * TrigSplit * Math.PI / 180);
ie[i].style.left = xpos + logoWidth * Math.cos(currStep + i * TrigSplit * Math.PI / 180);
Sz[i] = ie[i].style.pixelTop - ypos;
if (Sz[i] < 5) Sz[i] = 5;
ie[i].style.fontSize = Sz[i] / 1.7;
}
currStep -= step;
setTimeout('animateLogo()', 20);
}
window.onload = animateLogo;
}
// End -->
</script>

Link With in

Related Posts Plugin for WordPress, Blogger...