วิชวลเบสิกดอทเน็ต (vb.net) Visual Basic Dot Net

ปรับปรุง : 2551-07-27 (เพิ่ม OOP)
ข้อมูลทั้งหมดเกี่ยวกับ dotnet ได้จากการ อ่าน ทดสอบ และใช้เวลาไปมากมายในแต่ละเรื่อง ..
ไม่มีเรื่องใดได้จากการนั่งทางใน .. แม้พยายามนั่งแล้วก็ตาม ..
ถ้าเป็นไปได้ช่วย copy ทุกอย่างที่ผมเขียนไปเผยแพร่ต่อด้วย .. จะได้ลดเวลาในการค้นหา และทดสอบ
สารบัญ
a. 151 Keywords
b. VB Run-Time Library
c. 17 Data Type
d. 16 Data Conversion
e. Toolbox, Win. Control
f. Put&Get in Listbox
h. Sub & Function
i. Data Connection
j. Datagridview
z. Assignment ..

. . . . . . . . . . . . . . . . . .
ตัวอย่างฟอร์มโปรแกรม
+ dgrid1.zip
+ order_northwind.zip
+ Webpage Loader 1.0
1.Introduction
1.1 ติดตั้ง Visual Studio 2005.zip
1.2 เริ่ม vb.net สร้างปุ่ม Close.zip
1.3 start ใน class หรือ module.zip
2.Microsoft Access
2.1 Access97 + Create_Listbox.zip
2.2 Datagridview+Listbox+Textbox.zip
2.3 Datagridview + Update.zip
+ Select Flowing in NorthWind TB.
+ Office97 : northwind.mdb (532 KB)
+ MDB Viewer Program 755 KB
3.SQL Server
3.1 เริ่ม SQL Server Express 2005.zip
3.2 Odbc +SE2005 +Datagridview.zip
3.3 Insert +SQLexpress +AddUser.zip
4.MySQL
4.1 Datagridview +MySQL +Odbc
set names 'tis620'
.zip
5.Streaming
5.1 Stream + Create.zip
6.Data Updating
6.1 Basic to update in Listbox
6.2 update .mdb by microsoft.jet.oledb
6.3 update mysql by connection/net
6.4 Order Form with northwind
7.Crystal Report
7.1 Form in Crystal Report.zip
7.2 Value:Form to Crystal Report.zip
7.3 Pass 2 var to CrystalReport #1
7.4 Pass 2 var to CrystalReport #2
8.Web Service
8.1 Web Service
9.Non VB.NET
9.1 Basic to ASPX
9.2 MySQL5.1 + EMS.zip

Print Screen Sample
+ ตัวเลือก สำหรับสร้างโปรเจคใหม่
Data Sample:
+ northwind.mdb (532 KB)
+ dthai97.mdb 70 KB
  tbthai: fid int, fname string, fsalary double
+ boardx.mdb 108 KB
  questions, answers, users ..
+ search.mdb 662 KB
  webdat, describ, group, url

แก้ปัญหาภาษาไทย

Download MySQL Connector
- Connector/Net
+ MySQL Connector/Net 5.1 *
+ MySQL Connector/Net 5.0
- Connector/ODBC
+ Connector/ODBC 5.1
+ Connector/ODBC 3.51 *
    การเพิ่มผู้ใช้ใน SQLExpress 2005 (Peter)
  1. บอกให้ SQLServer ยอมรับวิธีเข้ารหัสของวินโดว์ ?
    DOS>REGEDIT
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft
    \Microsoft SQL Server\MSSQL.1\MSSQLServer
    LoginMode = 2 (Old value = 1)
    ถ้าไม่ reboot จะใช้ User ที่สร้างใหม่ Connect ไม่ได้
  2. สร้างตาราง และตัวอย่างข้อมูล เพื่อทดสอบใน windows form
    DOS>SQLCMD -S.\SQLEXPRESS -E
    1> create database dbthai
    2> go
    1> use dbthai
    2> go
    1> create table tbthai(id int,name varchar(10))
    2> go
    1> insert into tbthai values(1,'abc')
    2> insert into tbthai values(2,'def')

    3> go
    1> select * from tbthai
    2> go
  3. สร้างรหัสผู้ใช้ และรหัสผ่านสำหรับเข้าใช้ระบบ
    DOS>cd C:\Program Files\Microsoft SQL Server\90\Tools\Binn>
    DOS>SQLCMD -S.\SQLEXPRESS -E
    sp_addLogin 'thai', 'thai2007'
    GO
    sp_addsrvrolemember 'thai', 'sysadmin'
    GO
  4. เพิ่มระเบียนใหม่ใน Windows Form ของ VB.NET ?
    Imports system.data.sqlclient
    Dim conn As SqlConnection
    Dim myCommand As SqlCommand
    Dim ra As Integer
    Dim sql As String
    conn = New SqlConnection("server=.\sqlexpress;" + _
    "user id=thai;password=thai2007;database=dbthai")
    conn.Open()
    sql = "insert into tbthai values ("
    sql = sql + TextBox1.Text + ","
    sql = sql + "'" + TextBox2.Text + "')"
    myCommand = New SqlCommand(sql, conn)
    ra = myCommand.ExecuteNonQuery() ' ra = 1
    MessageBox.Show("New Row Inserted " & ra)
    conn.Close()
  5. แสดงข้อมูลจาก SQLServer ใน messagebox
    Imports system.data.sqlclient
    Dim conn As SqlConnection
    Dim myCommand As SqlCommand
    Dim s As String = ""
    conn = New SqlConnection("server=.\sqlexpress;" + _
    "user id=thai;password=thai2007;database=dbthai")
    conn.Open()
    myCommand = New SqlCommand("select * from tbthai", conn)
    Dim reader As SqlDataReader = myCommand.ExecuteReader()
    While reader.Read()
    s &= reader(1) & Chr(10) 'only name
    End While
    MessageBox.Show(s)
    conn.Close()

    แนะนำเว็บ (Web Guides) MySQL
    + Exploring MySQL in the Microsoft .NET Environment
    + Using MySQL with Visual Studio (ละเอียดดี)
    + Configuring a Connector/ODBC DSN on Windows
    + .NET Data Providers
    + Types of .NET Framework Data Provider Lesson
    + vbnet + mysql
    + e-book หลายภาษา หลากหลาย
    + e-book 8 บท ดีมาก
    + คำสั่งใน SQLCMD จาก MSDN
    + SQLCMD : SQL Command Line
    + SQLCMD บทที่ 1
    + http://www.a1vbcode.com
    + http://msdn2.microsoft.com/en-us/vstudio (official)
    + http://www.developerfusion.co.uk/vbnet/
    + เปิดสอน VB2005
    + สอน Visual Basic .net
    + สอน .net โดย ไพรัช เพลินมาลัย
    + http://www.codeproject.com
    - http://www.codeproject.com/aspnet/fileupload.asp
    + VB.Net Black (password: ganelon)
    + VB.Net Book 13 Chapters
    + หลักสูตร Crystal Report Version 11 โดย พงษ์พันธ์ ศิวิลัย
    * Check List เตรียมสมัครงาน

แหล่งอ้างอิง (Reference)
From : http://www.programmersheaven.com/2/VB-NET-School
1. Welcome to the VB.NET School 
2. Introduction to the .NET Framework & VB.NET 
3. VB.NET Language Fundamentals 
4. Classes & Objects 
5. Inheritance & Polymorphism in VB.NET 
6. Structures, Enumeration, Garbage Collection & Nested Classes 
7. Abstract Classes & Interfaces 
8. Arrays, Collections & String Manipulation 
9. Exception Handling in VB.NET 
10. Delegates & Events 
11. WinForms & Windows Applications 
12. More Windows Controls and Standard Dialog Boxes 
13. Data Access in .NET using ADO.NET 
14. Multithreading in VB.NET 
15. File System & Streams 
From : startvbdotnet.com
+ .NET Defined
+ OOP with VB
+ VB Language
+ Win Forms
+ Windows Controls
+ ADO .NET
+ User Controls
+ File Handling
+ Multithreading
+ Deployment
+ XML Web Services 
+ Essential XML
+ Resources
+ Discussions
+ ASP.NET
From : http://msdn2.microsoft.com/en-us/vbrun/ms788235.aspx (PDF e-Book)
1: Microsoft .NET Framework Primer for the Visual Basic Developer
2: Language Enhancements for Visual Basic 2005
3: Visual Studio 2005 Integrated Development Environment
4: Building Datacentric Applications
5: Constructing User Interfaces
6: Building Web Applications
7: Microsoft .NET Framework Enhancements
8: Deploying Applications

http://msdn2.microsoft.com/en-us/library/4c26cc39(vs.80).aspx Visual Studio Hardware Requirements - Processor : 600 MHz - Ram : 192 MB (ถ้าไม่มีปัญหาควร 1 GB) - HD : 1 GB to 4 GB - OS :
Windows 2000 Service Pack 4, Windows XP Service Pack 2,
Windows Server 2003 Service Pack 1, or Windows Vista3

http://www.startvbdotnet.com/ado/default.aspx
ตัวอย่างรหัสต้นฉบับอย่างสั้น (Short Source Code)
  1. สร้าง console application หรือเปลี่ยนใน Application type ก็ได้ แล้วสร้าง module ?
      Module Module1 Public a As Integer = 5 Sub main() Dim b As Integer b = a + 1 Console.WriteLine(b) a = Val(Console.ReadLine()) b = a + 5 For a = b To 10 : Console.WriteLine(a) : Next If a = 1 Then Console.Write(5) Console.ReadLine() End Sub End Module
  2. สร้าง Module ที่มี sub main จะแสดงชื่อ module ให้เลือกใน Startup Object
      Module Module1 Sub main() MsgBox(5) End Sub End Module
  3. ใน form1 สามารถสร้างและเรียกใช้ method ของตนได้
      Public Class Form1 Sub m() MsgBox(6) End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Call m() End Sub End Class
  4. ถ้าสร้าง method ใน class แบบ shared จะเรียกใน form ได้ ถ้า imports
      Public Class Class1 Shared Sub m() MsgBox(6) End Sub End Class Imports WindowsApplication1.Class1 Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Call m() End Sub End Class
  5. ใช้แต่ method สร้าง form และ control ใน runtime
    All these Windows Controls are based on the Control class, the base class for all controls.
    Visual Basic allows us to work with controls in two ways: at design time and at runtime. ?
    The Control class is in the System.Windows.Forms namespace.
    เลือก enable application framework ใน WindowsApplication Properties แล้วเลือก Sub Main
      Module Module1 Sub main() Dim instance As New Form Dim cm As New Button cm.Text = "abc" instance.Size = New Size(300, 200) instance.Controls.Add(cm) instance.ShowDialog() End Sub End Module
  6. ใช้แต่ method สร้าง form และ control และ event
      Module Module1 Sub main() Dim instance As New Form Dim lb As New ListBox Dim cm As New Button AddHandler cm.Click, AddressOf cmEventHandler cm.Text = "abc" lb.Items.Add("ทดสอบ") lb.Items.Add("ไทยออล") lb.Left = 100 ' pixels AddHandler lb.Click, AddressOf lbEventHandler instance.Size = New Size(300, 200) instance.Controls.Add(cm) instance.Controls.Add(lb) instance.ShowDialog() End Sub Public Sub cmEventHandler(ByVal sender As Object, ByVal e As System.EventArgs) MsgBox(sender.text.ToString) End Sub Public Sub lbEventHandler(ByVal sender As Object, ByVal e As System.EventArgs) Dim s As ListBox = sender MsgBox(s.Items(s.SelectedIndex.ToString)) ' MsgBox(sender.items(1)) ' ไทยออล End Sub End Module
  7. ฟังก์ชัน อาร์เรย์ และวันที่ (Random & Array & Date)
      Dim v1 As Integer = CInt(Rnd() * 100) Dim v2 As Double = Rnd() Dim v3() As Integer = {5, 6} MsgBox(v1 & "-" & v2 & "-" & v3(0) & "-" & v3.Length) Dim v4 As Date v4 = Now '11/13/2007 8:29:50 PM v4 = #11/13/2007# MsgBox(TimeOfDay & " " & v4) ' 8:29:50 PM 11/13/2007 Dim v5(2) As Integer v5(0) = 7 : v5(1) = 8 : MsgBox(v5(0) + v5(1)) ' 15 Dim v6 As Integer v6 = DateDiff(DateInterval.Day, #10/13/2006#, v4) ' 396 MsgBox(v6) Dim v7 As String = "abcdef" MsgBox(Mid(v7, 1, 2) & Microsoft.VisualBasic.Left(v7, 2)) Dim v8() As String v8 = Split("a+b+c", "+") MsgBox(v8(0) & chr(10) & v8(1)) ' chr(65)=A & Asc("A")=65 & Format(Asc("A"), "000")=065
  8. การสุ่มแบบไม่ซ้ำ (Random & No duplicate)
      Randomize() Dim a(5) As Integer, i, j As Integer, s As String = "", found As Boolean For i = 0 To 5
      found = False
      Dim t As Integer = CInt(Rnd() * 10)
      For j = 0 To i - 1
      If a(j) = t Then found = True
      Next
      If (found) Then i -= 1 Else a(j) = t : s &= t & Chr(10) Next MsgBox(s)
  9. consoleapplication + byval + byref + sub + function (stop with breakpoint + ต.ย.ข้อสอบ)
      Module Module1
      Dim a As Integer
      Sub Main()
      Dim a As Integer = 5
      sub1(a, a)
      Console.WriteLine(func1(a, a)) ' 25
      End Sub
      Sub sub1(ByVal x As Integer, ByRef y As Integer)
      a += x : x += a : y += a
      End Sub
      Function func1(ByVal x As Integer, ByRef y As Integer) As Integer
      func1 = a + x + y
      End Function End Module
  10. Timer + Nanosecond + Progressbar
      Public Class Form1 ' The value of this property represents the number of 100-nanosecond intervals ' that have elapsed since 12:00:00 midnight, January 1, 0001. Dim start As Long Private Sub Form1_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load start = Now.Ticks Timer1.Interval = 250 'milliseconds Timer1.Start() End Sub Private Sub Button1_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button1.Click MsgBox("Nano Second = " & (Now.Ticks - start)) End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Timer1.Tick If (ProgressBar1.Value = 100) Then ProgressBar1.Value = 0 ProgressBar1.Value += 1 Button1.Text = ProgressBar1.Value End Sub End Class
  11. โปรแกรมนี้ error เกี่ยวกับความเข้ากันได้ของคำสั่ง
    - ทำไม error ว่า Keyword not supported: 'provider'. ตอนส่งค่าให้ ConnectionString
    1. เพราะ provider=microsoft.jet.oledb.4.0 ใช้กับ SqlConnection ไม่ได้
    2. ถ้าใช้ SqlConnection ต้องเืชื่อมต่อกับ SQLServer ที่้กำหนด server, user, password, db
      Public Class Class1 Public Shared data As String = _ "provider=microsoft.jet.oledb.4.0;data source=c:\northwind.mdb" End Class
      Imports system.data.sqlclient Public Class Form1 Dim conn As SqlConnection Dim com As SqlCommand Private Sub Form1_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load Dim strconn As String = Class1.data conn = New SqlConnection() With conn If .State = ConnectionState.Open Then .Close() .ConnectionString = strconn ' Keyword not supported: 'provider' .Open() End With End Sub End Class
  12. จับเวลาการประมวลผล 10 ล้านรอบใน for ' my computer use about 62.5 Millisecond Module Module1 Dim i, j, startclock, stopclock As Long Sub Main() display_time(startclock) For i = 1 To 10000000 : j += i : Next display_time(stopclock) Console.WriteLine(stopclock - startclock) Console.ReadLine() End Sub Sub display_time(ByRef x As Long) x = Now.Ticks Console.WriteLine(Now.Millisecond & " millisecond " & Now.Ticks & " ticks") End Sub End Module
  13. ASP Short Code
      <body bgcolor=yellow> <form id="fm" runat="server"> <asp:TextBox ID="TextBox1" runat="server" Text="0"> </form> <% response.write(textbox1.text) %> <% Session("x") = TextBox1.Text %> </body> ' คำสั่งสำหรับปุ่มใน .vb เพื่อเปิดฟอร์มใหม่ Server.Transfer("default2.aspx", True) ' Session เป็นอีกวิธีหนึ่งที่ใช้ส่งค่าระหว่างฟอร์ม ' Response.Redirect("default.aspx?a=6") เป็นการส่งผ่าน request.querystring อีกวิธีหนึ่ง
  14. to call command in shell
      Shell("notepad.exe", AppWinStyle.NormalFocus) Shell("c:\x.bat", AppWinStyle.NormalFocus)
  15. to start & close process
      Dim p As New Process() Private Sub b1() p = Process.Start("C:\Windows\system32\calc.exe") End Sub Private Sub b2() p.CloseMainWindow() p.Close() End Sub
  16. SQL ที่น่ารู้สำหรับ Crystal Report มาก 1. select * from [order details] 2. select * from orders where orderdate = #11/16/1994# 3. select * from orders where customerid like "*A*" 4. select * from orders where employeeid > {?t1} 5. select * from orders where orderdate = {?t1} ' CDate(TextBox1.Text) 6. select orders.*,[order details].* from (
    [order details] inner join orders
    on [order details].orderid = orders.orderid
    ) where [order details].productid={?t1} and orders.employeeid = {?t2} Imports Crystaldecisions.shared ?
    Dim rpt As String
    rpt = "C:\CrystalReport1.rpt"
    CrystalReportViewer1.ReportSource = rpt
  17. การ ping และ download แฟ้มจากอินเทอร์เน็ต
    If My.Computer.Network.Ping("www.google.com", 1000) Then
    MsgBox("Server pinged successfully.")
    Else
    MsgBox("Ping request timed out.")
    End If
    My.Computer.Network.DownloadFile("http://www.thaiall.com/ta1.gif", "C:\ta1.gif")
    My.Computer.Network.UploadFile( _
    "C:\ta1.gif", "http://www.yourhost.com/upload.aspx", "anonymous", "")
    ' Format(1, "000")=001
    If My.Computer.FileSystem.FileExists("c://x.txt") Then
    My.Computer.FileSystem.DeleteFile("c://x.txt")
    My.Computer.Network.DownloadFile("http://www.thaiall.com", "C:\x.txt")
    msgbox(My.Computer.FileSystem.ReadAllText("c://x.txt"))
    Else
    My.Computer.Network.DownloadFile("http://www.thaiall.com", "C:\x.txt")
    End If
    วิชวลเบสิกดอทเน็ต
    วิชวลเบสิกดอทเน็ต คือการโปรแกรมที่มีสภาพแวดล้อมแบบกราฟิกสำหรับระบบปฏิบัติการวินโดว์ โดยมีโครงสร้างภาษาแบบภาษาเบสิก และทำงานบนดอทเน็ตเฟรมเวิร์ค ถูกพัฒนาให้เป็นการโปรแกรมเชิงวัตถุอย่างแท้จริง รองรับการออกแบบด้วยยูเอ็มแอล
    ความหมายของการโปรแกรมเชิงวัตถุ (Object-Oriented Programming)
    OOP เป็นเรื่องของวัตถุ (Object) ความหมายวัตถุ คือ “หน่วยหนึ่งของโปรแกรม ซึ่งมีหน้าที่การทำงานเฉพาะเจาะจง และถูกกำหนดปฏิสัมพันธ์กับโปรแกรมหน่วยอื่นอย่างแน่ชัด”
    นักเขียนโปรแกรม VB6 บางคนพบว่าตนไม่สามารถเขียนโปรแกรมใน VB.NET ได้ดีนัก เพราะพบแนวคิดที่แตกต่างจาก VB6 ไปมากจนไม่อาจปรับวิธีทำงานให้เข้ากับ VB.NET ได้ สาเหตุที่เป็นเช่นนั้นเพราะ VB6 เป็น Object based programming (การเขียนโปรแกรมที่มีพื้นฐานจากวัตถุ) ส่วน VB.NET เป็นภาษา OOP โดยสมบูรณ์ มิได้เป็นเพียง VB6 เวอร์ชันใหม่ ขณะที่นักเขียนโปรแกรมที่เคยเขียนภาษา C++ และหรือภาษาจาวา (Java Language) มาแล้วจะสามารถเรียนรู้ภาษา C# ได้อย่างรวดเร็ว เพราะมีพื้นฐานเกี่ยวกับ OOP มาก่อน
    ใน VB6 มี object อยู่จำนวนหนึ่งเรียกว่า Control (เช่นปุ่มและ Label) มันมี property method และ event ครบถ้วนเหมือน object ใน OOP แต่เราไม่สามารถนำมันมา “สืบสันดาน” (inheritance) หรือนำมาสร้างเป็น object ใหม่ โดยเพิ่มเติมแก้ไขคุณสมบัติของมันได้ง่ายเหมือนที่ทำได้ในภาษา .NET การไม่มีคุณสมบัติ inheritance เป็นเครื่องชี้ว่าภาษา VB6 ไม่ใช่ภาษา OOP
    ข้อมูลจาก http://www.meelink.com/webboard/data/3/0011-1.html
OOP in VB.NET
Public Class Form1
  Private Sub Form1_Load( ...
    Dim obj As New Test()
    obj.disp() ' hello
    Dim b As New child()
    MsgBox(b.sum() & b.add()) ' 13030
  End Sub
End Class
Public Class Test
  Sub disp()
    MsgBox("hello")
  End Sub
End Class
Public Class child
  Inherits father
  Private k As Integer = 100
  Public Function sum() As Integer
      Return i + j + k
  End Function
End Class
Public Class father
  Protected i As Integer = 10
  Protected j As Integer = 20
  Public Function add() As Integer
    Return i + j
  End Function
End Class
    OOP Sample Code ' Class and Object Imports System.Console Module Module1 Sub Main() Dim obj As New Test() obj.disp() Read() End Sub End Module Public Class Test Sub disp() Write("Object testing") End Sub End Class
    ' Constructor ' work to initialize the objects Imports System.Console Module Module1 Sub Main() Dim obj As New Test(5) Write(obj.dispx()) ' output = 7 Read() End Sub End Module Public Class Test Public x As Integer Public Sub New() x = 1 End Sub Public Sub New(ByVal value As Integer) x = value + 2 End Sub Function dispx() As Integer Return x End Function End Class
    ' Inheritance ' Reusing the class that is tested, debugged and used many times Imports System.Console Module Module1 Sub Main() Dim burin As New child() WriteLine(burin.sum()) ' 130 WriteLine(burin.add()) ' 30 Read() End Sub End Module Public Class child Inherits father Private k As Integer = 100 Public Function sum() As Integer Return i + j + k End Function End Class Public Class father Protected i As Integer = 10 Protected j As Integer = 20 Public Function add() As Integer Return i + j End Function End Class
    ' Polymorphism ' one name, multiple forms Imports System.Console Module Module1 Sub Main() Dim lampang As New child() WriteLine(lampang.dsp(10)) WriteLine(lampang.dsp("ten")) Read() End Sub End Module Public Class child Public Function dsp(ByVal i As Integer) As Integer Return i End Function Public Function dsp(ByVal i As String) As Integer Return 10 End Function End Class
    ' Interface ' allow us to create definitions for component interaction Imports System.Console Module Module1 Sub Main() Dim obj As New child() obj.disp() Write(obj.mul()) Read() End Sub End Module Public Interface myobj Sub disp() Function mul() As Double End Interface Public Class child Implements myobj Public i As Double = 12 Sub disp() Implements myobj.disp WriteLine(i) End Sub Public Function mul() As Double Implements myobj.mul Return i * i End Function End Class
    ' Abstract ' designed to act as a base class Imports System.Console Module Module1 Public MustInherit Class aburin Public i As Integer = 10 Public MustOverride Function Add() As Integer Sub dsp() Write(5) End Sub End Class Public Class burin Inherits aburin Shadows i As Integer = 20 Public Overrides Function Add() As Integer Return i + i End Function End Class Sub Main() Dim abs As New burin() WriteLine("one is " & abs.i) WriteLine(abs.Add()) abs.dsp() Read() End Sub End Module
    ' Structure ' defined for handling a group of logically related data items Imports System.Console Module Module1 Structure Employee Dim firstname As String Dim lastname As String End Structure Sub Main() Dim person As New Employee() person.firstname = "burin" person.lastname = "rujjanapan" Write(person.firstname + " " + person.lastname) Read() End Sub End Module
    คำถาม - คำตอบ (Question & Answer)
  1. ความแตกต่างของ C# กัย VB.NET ?
  2. รายชื่อโปรแกรมที่เคยถูกเปิดด้วย Visual Studio .net ลบออกได้อย่างไร
    ใช้ Regedit เข้าไปที่ HKCR\Software\Microsoft\VisualStudio\8.0\ProjectMRUList
  3. ถ้าแก้ Regedit ในส่วน LoginMode=2 และสร้าง user จะ connect ทันทีไม่ได้
    วิธีแก้คือ reboot เครื่องก่อน เพราะปัญหานี้ผมพบในเครื่องที่ติด deepfreeze
  4. SQL Server เก็บฐานข้อมูลที่โฟรเดอร์ใด
    เช่น แฟ้ม C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\dbthai.mdf
  5. สร้างฐานข้อมูลใน SQLExpress ชื่อ dbthaiall คล้ายกับ dbthai ทุกประการ มี 2 ระเบียน
    เก็บข้อมูลใน C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\
    โดย dbthaiall.mdf มีขนาด 2,293,760 bytes และ dbthaiall_log.LDF มีขนาด 516,096 bytes
    ถ้าไม่มีแฟ้ม dbthaiall_log.LDF ระบบจะสร้างขึ้นมาให้ใหม่ (ผมมี dbthaiall.zip 126 KB ให้นำไปทดสอบ)
  6. MySQL Server เก็บฐานข้อมูลที่โฟรเดอร์ใด
    เช่น โฟรเดอร์ C:\thaiabc\mysql\data\dbthai
  7. ลงทะเบียน ASP.NET เข้ากับ IIS ผ่าน DOS Prompt
    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727> aspnet_regiis.exe -i
  8. เปิด MSDN แล้วพบว่า ms-help://MS.MSDNQTR.v80.en invalid
    อาจมีวิธีแก้ไขหลายวิธี แต่ที่ผมทดสอบแล้วได้ผลมีขั้นตอนสั้น ๆ ดังนี้
    1. ไปที่ C:\Program Files\Common Files\Microsoft Shared\Help 8\Microsoft Document Explorer 2005
    2. สั่ง install.exe แล้วเลือก Repair แล้วทำไปจนจบ
    3. หลัง Reboot เครื่อง ผมใช้ MSDN ได้ตามปกติครับ

แนะนำเว็บใหม่ : ผลการจัดอันดับ
รักลำปาง : thcity.com : korattown.com : topsiam.com : มหาวิทยาลัยโยนก
ศูนย์สอบ : รวมบทความ : ไอทีในชีวิตประจำวัน : ดาวน์โหลด : yourname@thaiall.com
ติดต่อ ทีมงาน ชาวลำปาง มีฝันเพื่อการศึกษา Tel.08-1992-7223