Friday, May 16, 2008

NEW FORM IN VISUAL STUDIO

I am now going talk about a nice feature in VISUAL STUDIO
All you need to just see my code..
Its builts customized forms in VISUAL STUDIO.
Its works ,with the help of Windows Forms Generating System.
The code follows.......


using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace dataform
{

/// Summary description for Form1.

public class Form1 : System.Windows.Forms.Form
{
/// Required designer variable.

private System.ComponentModel.Container components = null;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}



protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code

/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.

private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.Size = new System.Drawing.Size(300,300);
this.Text = "Form1";
}
#endregion


/// The main entry point for the application.

[STAThread]
static void Main()
{
Application.Run(new Form1());
}
}
}

Saturday, May 3, 2008

TO MAKE A DATABASE (C#.NET)

One of my readers mailed me to solve his problem
Actually he is working for a software firm in Chennai,India.
There in their project,there was a module to create a database connection,
create a database,and create a table....These are much complicated in a sense.
Tell you..the actual value of each database should not be static.
Done ..he send me a mail to solve this.
Ok where ever you are please check my blog Mr.Anand kumar
It will help you i am sure....


------------------------------------------------------------------------------------

First of all we must add namespaces on our program
A complete general notes on basics of .net will present you later ok?


using system.data.sqlclient;

Then

add this

string source = (@"Data Source=.;Initial Catalog=*yourdatabasename*;Integrated Security=True");
string insert = ("insert into tbl_soft values('" + textBox1.Text + "','" + textBox2.Text + "')");
SqlConnection cnn = new SqlConnection(source);
cnn.Open();
SqlCommand cmd = new SqlCommand(insert,cnn);
cmd.ExecuteNonQuery();
MessageBox.Show("files added successfully");

here i've used certain controls to give the values in database rather sql server.
Those are textboxes.Once it generates the values ,it will add itself as Main and Sub Tables.

Wednesday, April 23, 2008

PASSING VALUES THROUGH PAGES

Inorder to get requsted values from one page to another,programmers do much things.
Now i'll tell you an interesting part of passing of value.
Either how to do that correctly and easly.

Response.Redirect("Default2.aspx?name=" + TextBox1.Text.ToString());

Actualy this is the default page's code,its shows that the click in Default page must get the user to Default2.aspx.
And it must keep the value of that which the user entering in a Textbox in Default page.
*This sort of program is using for intenet banking and money transactions.
To do this we must input codes for encryption also.That we'll discuss later.

Ok
After that Deafult page code
move towards Default2.aspx.

Label1.Text = Request.QueryString["name"].ToString();

Here i am storing the value to a label control

That's it.
Hope you enjoyed.
Send me your replys

DATABASE OPERATION

Now ,for this time only ,i will tell you about a c# application working with MS Access instead of SQL server.

For that you must call the namespace "system.data.oledb" first.
Then you can easly connect your application with MS access.

Keep this script with you.Send me your reply on this


namespace access
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
OleDbConnection cnn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\data1.mdb");
cnn.Open();
OleDbDataAdapter ad = new OleDbDataAdapter("select *from employee",cnn);
cnn.Close();
DataTable dt = new DataTable();
ad.Fill(dt);
dataGridView1.DataSource = dt;



}


Here you can see , I am calling the namespace and making the string which carries the path to our database.As always then create a connection,open it.Make an instance of adapter , then merge adapter's source to a datatable .Atlast store that value to an instane of Datagridview .There you are ,you'll now have your data on your page.


Next time same project will be in SQL SERVER.
Feel free to ask doubts.

Master Pages in ASP.net(Helpful for beginers)



A professional web site will have a standardized look across all pages. For example, one popular layout type places a navigation menu on the left side of the page, a copyright on the bottom, and content in the middle. It can be difficult to maintain a standard look if you must always put the common pieces in place with every webform you build. In ASP.NET 2.0, master pages will make the job easier. You’ll only need to write the common pieces once - in the master page. A master page can serve as a template for one or more web forms. Each ASPX web form only needs to define the content unique to itself, and this content will plug into specified areas of the master page layout.



CONFIGURING MASTERPAGES
----------------------------------


To add a master page to a web project, right-click your web project in the Solution Explorer window, select Add New Item, and select the Master Page item type from the Add New Item dialog. The listing below shows a sample master page in source view.

A master page looks very similar to an ASPX file, except a master page will have a .master file extension instead of a .aspx extension, and uses an @ Master directive instead of an @ Page directive at the top. Master pages will define the html, head, body, and form, tags. A new control, the ContentPlaceHolder control also appears in our master page. You can have one or more ContentPlaceHolder controls in a master page. ContentPlaceHolder controls are where we want our ASPX web forms to place their content.

Just like any ASPX form, our master page can contain code in a script block, or in a code-behind file, and can respond to page lifecycle events. The MasterPage class (from the System.Web.UI namespace) derives from UserControl and will have all of the usual events: Init, Load, PreRender, etc. The following listing shows how we’ve added a Page_Load event handler to modify the color of the menu control on the page, and we’ve also added a property to allow setting and retrieving the text inside the footer.



Master Pages and Configuration

---------------------------------------------

There are three ways to associate a web form with a master page. You can use the Master attribute in the @ Page directive, and you can write to the MasterPageFile property in the PreInit event or earlier. We’ve seen examples of both of these techniques. Any web form using the Master attribute of the @ Page directive or setting the MasterPageFile property programmatically will override the web.config settings.

Click me for more




c# universal

Using with DirectSound oversight_failure 23:22 23 Feb '05

Hi. This is some really helpful code, but I'm trying to implement it using DirectSound and hitting a roadblock.

Basically, I have a SecondaryBuffer with its built in DirectX effects. In addition, I'd like to be able to have my own custom effects thrown into the mix. I had no trouble converting the FX frame stuff and effects code so they compile with DirectSound instead of your WaveLib, but the process function uses a buffer and processes it with the effect. From what I can see, the SecondaryBuffer has no way of giving me the raw buffer it's using. There is a read function that isn't very well documented, but I'm not sure if that's what I want. Essentially I need to process the buffer with my own effects when the buffer's "Play" method is called. It's easy to add built in DirectX effects into the effects array, but I have no clue how to stick my own in.

Any pointers on processing a SecondaryBuffer would be great. Actually, any tips on implementing my own custom DirectX effects would be awesome.

Thanks!

Tuesday, April 22, 2008

Hyperlink for Repeater

*asp:Hyperlink Id="HyperLink" Runat="server" NavigateURL="< *%#DataBind.Eval(Container.DataItem, "myLink")%* >">< *%#DataBind.Eval(Container.DataItem, "myMenuItem")%* >< */asp:HyperLink>