????? ????? ?? ???? ???? ?????? ?? "Visual C" #

?????? ????????? ?????? ?????????
???? ???????: 816175 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

??????

???? ??? ??????? ????? ????? ?? ???? ???? ?????? ???????? Visual C# .NET ?? Visual C# 2005.

??????? ????

???????

???? ??????? ??????? ??????? ?????? ??? ????? ?????? ???????? ?????? ? ??? ??????? ????????:
  • ??? ????? ??????? ???????:
    • Microsoft Windows 2000 Professional (?? ????)
    • Microsoft Windows XP Professional ?? ?????? .NET Framework ??????
    • Microsoft Windows Server 2003
  • Microsoft Visual Studio .NET ?? Microsoft Visual Studio 2005.
  • Microsoft SQL Server ??????? 7.0 ?? ?????? ?? Northwind ????? ????????.
????? ??? ??????? ??? ??????? ??? ???????? ???????:
  • ????? ???????
  • ????? Windows
  • ado.net
Back to the top

????? ???? ???? ???? ??????

???? ??? ??????? ????? ????? ?? ????? ??? ???????? ??????? ???????:
  • ????? Visual C# Windows ?????? ?????? ?? ?????? ????? ??????? ??????.
  • ????? Visual Basic .NET ?? ????? 2005 Visual Basic ???? ??? ??? ????? ???????? NorthWind ?????? DataSet.
  • ????? ????? Visual C# ?? ?????? ????? ??? ????? ???? ???? ArrayList ?????? ????? ????? ?????? ????? ????? ?????? ???????? ???? ??? ?? StringBuilder.
?????? shell ????? Windows C# Visual ??????? ?? ??? ???? ???? ??????? ???????:
  1. ???? ??? ???? ? ???? ??? ??????? ?? ?? ???????? ??? Microsoft Visual Studio .NET (?? Visual Studio .NET 2002) ?? Microsoft Visual Studio .NET 2003 (?? Microsoft Visual Studio .NET 2003) ?? Microsoft Visual Studio 2005 (?? Microsoft Visual Studio 2005).
  2. ???? ??? ?????? Microsoft Visual Studio .NET ?? Microsoft Visual Studio 2005.
  3. ???? ??? ????? ???? ?? ???? ??? Visual C# ????????

    ?????? ?? Visual Studio 2005 ? ???? ??? Visual C#.
  4. ??? ????? ? ???? ??? ????? Windows.
  5. ?? ????? ??? ???? HowToMultiComp ??? ?? ???? ??? ?????.
  6. ??? ????? ??????? ???? ?? ???? "?????? ??????". ?? ???? ??? ???? "?????? ??????" ???? CTRL + ALT + L.

    ???? ???? shell ??????? "?????" Visual C# ?? Windows ?? ??? ???? ?????? HowToMultiComp.
?????? ?? ???? ???? ?????? ????? Visual C# "??? ?????" ?? ?? ?????? Visual Basic .NET ?? ????? ?????? 2005 Visual Basic.

??? ????? ????? ?????? Visual Basic ?????. ?????? "????? ?????? Visual Basic" ? ???? ??????? ???????:
  1. ?? "?????? ??????" ???? ??? ?????? ?????? ??? ?? 'HowToMultiComp' ? ??? ??? ????? ? ?? ???? ??? ????? ????.
  2. ???? ??? ?????? Visual Basic.

    ?????? ?? Visual Studio 2005 ? ???? ??? Visual Basic.
  3. ??? ????? ? ???? ??? ????? ??????.
  4. ?? ?????? ?????? ???? NWClassLib ??? ?? ???? ??? ?????.

    ??? ????? Visual Basic .NET ?? ????? ?????? 2005 Visual Basic ??? ????.

    ??? ???? ??? ?? ???? Class1.vb ??????.
  5. ????? ??????? ?????? ????????? ????? ?????? ?????? ???? ????? ?????? ??? ?????? ?? ?????? ??????? ???????:
    Imports System.Data
    Imports System.Data.SqlClient
  6. ????? ?????? DataSet ?? ???????? ?? ???? ?????? Northwind ??? ??????? ?????? ??? Class1 (?? ???? ??? ??? ????? ??????? ????????? ????? ??): ds
    Public Shared Function GetProducts() As DataSet
    	Dim ds As New DataSet()
    	Dim sqlDS As New SqlDataAdapter("select * from products", New SqlConnection("server=<network address of instance of SQL Server>;database=northwind;integrated security=sspi"))
    	sqlDS.Fill(ds)
    	return ds
    End Function
    
????? ????? C# ?????? ?????. ?????? ????? ???? ??????? ???????:
  1. ?? "?????? ??????" ???? ??? ?????? ?????? ??? ?? 'HowToMultiComp' ? ??? ??? ????? ? ?? ???? ??? ????? ????.
  2. ???? ??? Visual C# ????????.

    ?????? ?? Visual Studio 2005 ? ???? ??? Visual C#.
  3. ??? ????? ? ???? ??? ????? ??????.
  4. ?? ?????? ?????? ???? SBClassLib ??? ?? ???? ??? ?????.

    ??? ????? Visual C# "??? ?????" ??? ????.

    Class1.cs ????? ???? ?? ???? ????.
  5. ????? ??????? ???????? ??????? ?? ???? ????? ????????? ???????? Class1.cs ?????? ???? ????? ?????? ??? ?????? ?? ????? ????? System.Text ?????? System.Collections:
    using System.Text;
    using System.Collections;
  6. ?? ?????? ????????? ???????? ??????? ?? ????? ?????? Class1 ? ????? ?????? ???? ??? ?? StringBuilder ???????? ????? ????? ???????? ?? ArrayList:
    public static String BuildString(ArrayList arlStrings)
    {
    	StringBuilder sb = new StringBuilder();
    	
    	foreach(String s in arlStrings)
    	{
    			sb.Append(s);
    			sb.Append(", ");
    	}
    	return sb.ToString();
    }
????? ???? ????? ??????? ????? Visual C# ?? Windows ???? ?????? ??? ??????. ????? ??????? ?????? ?? Visual C# Windows ? ???? ??????? ???????:
  1. ?????? ????? ?????? "????? ??????" ???? ??????? ???????:
    1. ?? "?????? ??????" ???? ??? ?????? ?????? ??? ????? ??? HowToMultiComp ??? ?? ???? ??? ????? ????.
    2. ??? ???????? ???? ? ??????? CTRL ?? ???? ??? NWClassLib ?? ???? ??? SBClassLib.
    3. ?? ??? ????????? ????? ???? ??? ?????.
    4. ??? ???? ??? ?? ???????? ?? ??????? ?????? ? ???? ??? ?????.

      ??? ???? ????? ???????? ??? ????? ?????? ????.
  2. Form1.cs ????? ?? ????? ????? "?????". ??? ??? Form1.cs ?? ??? ? ???? ????? ??????? ??? Form1.cs ?? "?????? ??????" ??????.
  3. ???? CTRL + ALT + X ???? ???? ??????? ?? ???? ??? ????? Windows.
  4. ???? ??? ????? ??? ??????? ?? ???? F4 ?????? ??? ???? ????? ??.
  5. ????? ????? ??????? ???? ??? ????? ????????.
  6. ????? ?? ??? ?? ?? ?????? ?? ??????? ????? ?????.
  7. ?? ???? ???? ???? DataGrid ??? ??????? ?? ?? ??????? ???? ???????. ????? ??? ???? ?????? DataGrid ???? ???? ????? ???????? ?? ???????.
  8. ???? ????? ??????? ??? ????? ????????. Visual Studio .NET ???????? ?????? ????? ??? ????.
  9. ?? ?????? ????????? ???????? ??????? ????? ??????? ????:
    dataGrid1.DataSource = NWClassLib.Class1.GetProducts().Tables[0];
    ????????? ???????? ??? ????? ??????? DataSourceDataGrid ??? DataSet ???? ?? ??????? ?????? ??????? GetProducts "????? ??????".
  10. ????? ????? ??? ???? ???? ? ???? ????? ??????? ??? ????? ?????.
  11. ???????? ???????? ??????? ???? ??????? ?? ???? ?? ???? ????? DataGrid ??? ?????? 7 ?? ???? ?????? ????? ??? ArrayList. ?? ??? ????? ArrayList ??? ??????? SBClassLibrary ?????? ????? ???? ?? ???? MessageBox. ???? ????? ??? ???????? ???? ?? ????? ??????? ?????? ???????? ?????? ???????? ?????.

    ????? ????????? ???????? ??????? ??? ????? ??????? ???: arl
    ArrayList arl = new ArrayList();
    for(int i = 0; i <= 8; i++)
    	arl.Add(dataGrid1[0, i].ToString());
    MessageBox.Show(SBClassLib.Class1.BuildString(arl));
Back to the top

????? ??? ????????? ????????

????? ??? ????? (Class1.vb)

Imports System.Data
Imports System.Data.SqlClient

Public Class Class1
    Public Shared Function GetProducts() As DataSet
        Dim ds As New DataSet()
        Dim sqlDS As New SqlDataAdapter("select * from products", New SqlConnection("server=<network address of instance of SQL Server>;database=northwind;uid=sa"))
        sqlDS.Fill(ds)
        Return ds
    End Function
End Class
Back to the top

????? ??? ????? (Class1.cs)

using System;
using System.Text;
using System.Collections;

namespace SBClassLib
{
	public class Class1
	{
		public Class1()
		{
			
		}

		public static String BuildString(ArrayList arlStrings)
		{
			StringBuilder sb = new StringBuilder();

			foreach(String s in arlStrings)
			{
				sb.Append(s);
				sb.Append(", ");
			}
			return sb.ToString();
		}
	}
}
Back to the top

????? ??? ????? (Form1.cs)

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

namespace HowToMultiComp
{
	
	public class Form1 : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.Button button2;
		private System.Windows.Forms.DataGrid dataGrid1;
		
		private System.ComponentModel.Container components = null;

		public Form1()
		{
			InitializeComponent();
		}

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

		private void InitializeComponent()
		{
			this.button1 = new System.Windows.Forms.Button();
			this.button2 = new System.Windows.Forms.Button();
			this.dataGrid1 = new System.Windows.Forms.DataGrid();
			((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
			this.SuspendLayout();
			// 
			// button1
			// 
			this.button1.Name = "button1";
			this.button1.Size = new System.Drawing.Size(104, 23);
			this.button1.TabIndex = 0;
			this.button1.Text = "Show Products";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// button2
			// 
			this.button2.Location = new System.Drawing.Point(136, 0);
			this.button2.Name = "button2";
			this.button2.Size = new System.Drawing.Size(96, 23);
			this.button2.TabIndex = 1;
			this.button2.Text = "Build String";
			this.button2.Click += new System.EventHandler(this.button2_Click);
			// 
			// dataGrid1
			// 
			this.dataGrid1.DataMember = "";
			this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
			this.dataGrid1.Location = new System.Drawing.Point(0, 24);
			this.dataGrid1.Name = "dataGrid1";
			this.dataGrid1.Size = new System.Drawing.Size(296, 256);
			this.dataGrid1.TabIndex = 2;
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(292, 273);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.dataGrid1,
																		  this.button2,
																		  this.button1});
			this.Name = "Form1";
			this.Text = "Form1";
			((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
			this.ResumeLayout(false);

		}

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

		private void button1_Click(object sender, System.EventArgs e)
		{
			dataGrid1.DataSource = NWClassLib.Class1.GetProducts().Tables[0];
		}

		private void button2_Click(object sender, System.EventArgs e)
		{
			ArrayList arl = new ArrayList();
			for(int i = 0; i <= 8; i++)
				arl.Add(dataGrid1[0, i].ToString());
			MessageBox.Show(SBClassLib.Class1.BuildString(arl));
		}
	}
}
?????? ??? ?? ??? ????? ????????? ???????? ?? Visual Studio 2005. ??? ????? ????? Windows ????? Visual C# ????? ????? ??? ??????? ???? ???????. ???? ??? ??????? Form1. ???? ??????? ???? ???? ??????? Form1.cs Form1.designer.cs. ????? ????????? ???????? ?? Form1.cs. ??? ????? Sesigner.cs ??? ???? & ???? ????? Windows ????????? ???????? ???? ???? ?????? ???? ????????? ????? ?? ???? ????? ????? ????. ?????? ??? ???? ?? ????????? ??? ???? ????? Windows ?? Visual C# 2005 ?? ?????? ???? Microsoft ?????? ??? ?????:
http://msdn2.microsoft.com/en-us/library/ms173077.aspx
Back to the top

???? ?? ???? ?? ???

  1. ???? F5 ?????? ??????? ?? ??? ???????.
  2. ??? ???? "???????" ? ???? ??? ????? ????????.

    ???? DataGrid ???? ???????? ?? ???? ?????? Northwind.
  3. ???? ??? ????? ?????.

    ???? ???? ????? ???? ???? ???????? ??????? ????? ???? ????? ?? ???? ?????? ???? ????? ??? ???? 7 (?????).
  4. ???? SHIFT + F5 ????? ????? ??????? ??? Visual Studio .NET.
Back to the top

??????? ??????? ????????

???? ?? ?? ?? ???? ??? ???? ?????? ??? ????? ?? ?????. Visual C# ????? ???? ???? ????? ????? ?? ???? ?????? ???????? ??? ?? ??????? ??? ???? ????? ??? ?? Visual Basic .NET ?? ?? Viusal Basic 2005. ?????? ?? ????? ??? ??????? ???????? "????????? ?????" ???? ?? ?????? ????? ????? ????? .NET Framework ???????? ????? ??? ????????. ??? ????? ????????? ??????? ?? ??????? MS:
ms:help://MS.VCC/MS.MSDNVS/vsintro7/html/vxgrfLanguageEquivalents.htm
Back to the top

?????

????? ?? ?????????? ?? ?????? ???? MSDN ?????? ??? ?????:
????? ?? Mutli-?????
http://msdn2.microsoft.com/en-us/library/aa265251(VS.60).aspx
Back to the top

???????

???? ???????: 816175 - ????? ??? ??????: 29/???? ??????/1428 - ??????: 2.5
????? ???
  • Microsoft Visual C# 2005 Express Edition
  • Microsoft Visual C# .NET 2003 Standard Edition
  • Microsoft Visual C# .NET 2002 Standard Edition
????? ??????: 
kbmt kbhowtomaster kbinterop kbappdev kbhowto KB816175 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????816175

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com