GO
How do I use G O
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: crBaoCao.cs
Copy
119 public virtual bool ShareDBLogonInfo {
120 get {
121 return false;
122 }
123 set {
124 //
125 }
126 }
File name: FormBaoCao.cs
Copy
40 private void btnLoc_Click(object sender, EventArgs e)
41 {
42 SqlConnection con = dal.GetConnect();
43 con.Open();
44 string sql = "select *from SinhVien where MaLop=@MaLop";
45 SqlDataAdapter da = new SqlDataAdapter(sql, con);
46 da.SelectCommand.Parameters.AddWithValue("@MaLop", cmbMaLop.SelectedValue.ToString());
47 DataTable dt = new DataTable();
48 da.Fill(dt);
49 crBaoCao cr = new crBaoCao();
50 ConnectionInfo crConnectionInfo = new ConnectionInfo();
51 crConnectionInfo.ServerName = "Ty-PC";
52 crConnectionInfo.DatabaseName = "CNPM_1";
53 crConnectionInfo.UserID = "sa";
54 crConnectionInfo.Password = "04091990";
55 TableLogOnInfos crTableLogonInfos = new TableLogOnInfos();
56 foreach (CrystalDecisions.CrystalReports.Engine.Table table in cr.Database.Tables)
57 {
58 TableLogOnInfo crTableLogonInfo = new TableLogOnInfo();
59 crTableLogonInfo.TableName = table.Name;
60 crTableLogonInfo.ConnectionInfo = crConnectionInfo;
61 crTableLogonInfos.Add(crTableLogonInfo);
62 table.ApplyLogOnInfo(crTableLogonInfo);
63
64 }
65 crvHocKyHocPhan.LogOnInfo = crTableLogonInfos;
66 cr.SetDataSource(dt);
67 ParameterValues a = new ParameterValues();
68 ParameterDiscreteValue b = new ParameterDiscreteValue();
69 b.Value = cmbMaLop.SelectedValue.ToString();
70 a.Add(b);
71 cr.DataDefinition.ParameterFields["txtMaLop"].ApplyCurrentValues(a);
72 crvHocKyHocPhan.ReportSource = cr;
73 crvHocKyHocPhan.Show();
74 }
File name: frmThiThat.cs
Copy
50 void TaoBangRandomCauHoi(DataTable BangQuestion)
51 {
52
53 try
54 {
55 Random Rnd = new Random();
56 ArrayList ArrQuestion = new ArrayList();
57
58 ArrQuestion.Clear();
59 int x, dem = 0;
60 int SoCauTrongBangGoc = BangQuestion.Rows.Count;
61 while (dem < SoCauNgauNhien)
62 {
63 x = Rnd.Next(0, SoCauTrongBangGoc);
64 if (!ArrQuestion.Contains(x))
65 {
66 ArrQuestion.Add(x);
67 dem++;
68 }
69 }
70 for (int j = SoCauTrongBangGoc - 1; j >= 0; j--)
71 if (!ArrQuestion.Contains(j))
72 BangQuestion.Rows.RemoveAt(j);
73
74 BangDeThi = BangQuestion;
75 BangDeThi.Columns.Add("cauhoi,DAPAN");
76
77 }
78 catch (Exception ex)
79 { MessageBox.Show(ex.Message); }
80
81 }
File name: rptThisinh.cs
Copy
111 public virtual bool ShareDBLogonInfo {
112 get {
113 return false;
114 }
115 set {
116 //
117 }
118 }
File name: ChatGui.cs
Copy
348 public void OnStatusUpdate(string user, int status, bool gotMessage, object message)
349 {
350 // this is how you get status updates of friends.
351 // this demo simply adds status updates to the currently shown chat.
352 // you could buffer them or use them any other way, too.
353
354 ChatChannel activeChannel = this.selectedChannel;
355 if (activeChannel != null)
356 {
357 activeChannel.Add("info", string.Format("{0} is {1}. Msg:{2}", user, status, message));
358 }
359
360 Debug.LogWarning("status: " + string.Format("{0} is {1}. Msg:{2}", user, status, message));
361 }
File name: BallControl.cs
Copy
10 void GoBall() {
11 float rand = Random.Range (0, 2);
12 if (rand < 1) {
13 rb2d.AddForce (new Vector2 (20, -15));
14 } else {
15 rb2d.AddForce (new Vector2 (-20, -15));
16 }
17 }
File name: BallControl.cs
Copy
20 void Start () {
21 rb2d = GetComponent
22 Invoke ("GoBall", 2);
23 }
File name: BallControl.cs
Copy
31 void RestartGame() {
32 ResetBall ();
33 Invoke ("GoBall", 1);
34 }
File name: OnClickCallMethod.cs
Copy
11 public void OnClick()
12 {
13 if (this.TargetGameObject == null || string.IsNullOrEmpty(this.TargetMethod))
14 {
15 Debug.LogWarning(this + " can't call, cause GO or Method are empty.");
16 return;
17 }
18
19 this.TargetGameObject.SendMessage(this.TargetMethod);
20 }
File name: PunStartup.cs
Copy
34 static void OnUpdate()
35 {
36 bool doneBefore = EditorPrefs.GetBool("PunDemosOpenedBefore");
37 if (doneBefore)
38 {
39 EditorApplication.update -= OnUpdate;
40 return;
41 }
42
43 if (String.IsNullOrEmpty(EditorApplication.currentScene) && EditorBuildSettings.scenes.Length == 0)
44 {
45 #if UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_5_1 || UNITY_5_2
46 if (EditorApplication.isUpdating) return;
47 #endif
48
49 LoadPunDemoHub();
50 SetPunDemoBuildSettings();
51 EditorPrefs.SetBool("PunDemosOpenedBefore", true);
52 Debug.Log("No scene was open. Loaded PUN Demo Hub Scene and added demos to build settings. Ready to go! This auto-setup is now disabled in this Editor.");
53 }
54 }
Download file with original file name:GO
GO 185 lượt xem
Gõ tìm kiếm nhanh...