[.NET] 超新手-程式碼的排版方式的意義
各位前輩好,小弟是看書自學的超新手,非資訊相關的學生
所以有個很基本的問題想要請教一下(應該是太基本了,書本連題都不提....)
就是關於程式碼的排版方式隱含的意義
以下是我照書本練習的結果
Public Class Form1
Private Sub Form1_Click(sender As Object, e As EventArgs) Handles Me.Click
Me.Text = "表單Click事件測試"
Me.BackColor = Color.Green
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.Text = "表單Load事件測試..."
Me.WindowState = FormWindowState.Maximized
End Sub
Private Sub Form1_Activated(sender As Object, e As EventArgs) Handles MyBase.Activated
Me.Text = "表單Activated事件測試..."
Me.BackColor = Color.Orange
End Sub
End Class
這裡是我的問題
1.每句statement前的抬頭空白是用來給閱讀者方便檢視用的,並不會影響執行的結果
因為執行的最小單位是"一句statement"
2.Keyword的第一個字母一定要大寫嗎?
我想測試看看,但是每次我試著改成小寫時,IDE都會自動幫我改回大寫...
3.每個Private Sub在排版上的先後順序不會影響執行結果,排版一樣是為了方便檢視
ex:我的Click事件放在Activated之前不會有問題
4.Public Class Form1之後一定要空一行才能開始寫其它的程式碼嗎?
5.句子裡,( ) _ , . ' " + - * / 前後多了或少了空格會不會造成錯誤
ex: Me.Text = ".........."
Me . Text="......"
6.Load事件根本看不到啊...書裡說會看到的
謝謝各位的閱讀 ^ ^
另外還有點我不知道怎麼問的問題
IDE輔助下寫出的程式碼:
Private Sub Form1_Click(sender As Object, e As EventArgs) Handles Me.Click
書本上的程式碼:
Private Sub Form1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Me.Click
兩者執行結果一樣
但是為什麼少了ByVal跟System,這些是?
我爬一下文只知道sender跟e是所謂的KeyPress事件..但是還是搞不清楚
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 218.166.4.51
→
08/21 15:40, , 1F
08/21 15:40, 1F
→
08/21 15:40, , 2F
08/21 15:40, 2F
→
08/21 15:41, , 3F
08/21 15:41, 3F
→
08/21 15:42, , 4F
08/21 15:42, 4F
→
08/21 15:42, , 5F
08/21 15:42, 5F
→
08/21 15:43, , 6F
08/21 15:43, 6F
→
08/21 15:44, , 7F
08/21 15:44, 7F
→
08/21 15:44, , 8F
08/21 15:44, 8F
→
08/21 15:45, , 9F
08/21 15:45, 9F
→
08/21 15:46, , 10F
08/21 15:46, 10F
→
08/21 15:46, , 11F
08/21 15:46, 11F
→
08/21 15:47, , 12F
08/21 15:47, 12F
→
08/21 15:47, , 13F
08/21 15:47, 13F
→
08/21 15:48, , 14F
08/21 15:48, 14F
→
08/21 15:48, , 15F
08/21 15:48, 15F
→
08/21 15:48, , 16F
08/21 15:48, 16F
→
08/21 15:49, , 17F
08/21 15:49, 17F
→
08/21 15:49, , 18F
08/21 15:49, 18F
→
08/21 15:52, , 19F
08/21 15:52, 19F
→
08/21 16:05, , 20F
08/21 16:05, 20F
→
08/21 16:06, , 21F
08/21 16:06, 21F
→
08/21 16:07, , 22F
08/21 16:07, 22F
→
08/21 16:08, , 23F
08/21 16:08, 23F
→
08/21 16:09, , 24F
08/21 16:09, 24F
→
08/22 21:14, , 25F
08/22 21:14, 25F
推
08/22 22:00, , 26F
08/22 22:00, 26F
→
08/22 22:03, , 27F
08/22 22:03, 27F
→
08/22 22:03, , 28F
08/22 22:03, 28F
→
08/22 22:06, , 29F
08/22 22:06, 29F
→
08/22 22:08, , 30F
08/22 22:08, 30F
→
08/22 22:12, , 31F
08/22 22:12, 31F
→
08/22 22:12, , 32F
08/22 22:12, 32F
→
08/22 22:15, , 33F
08/22 22:15, 33F
→
08/22 22:15, , 34F
08/22 22:15, 34F
→
08/22 22:16, , 35F
08/22 22:16, 35F
→
08/23 01:16, , 36F
08/23 01:16, 36F
→
08/23 15:37, , 37F
08/23 15:37, 37F
→
08/23 15:39, , 38F
08/23 15:39, 38F
→
08/23 15:41, , 39F
08/23 15:41, 39F
→
08/23 15:41, , 40F
08/23 15:41, 40F
Visual_Basic 近期熱門文章
PTT數位生活區 即時熱門文章