Saturday, September 7, 2013

Visual Basic 6.0 และ การใช้ Snapshot ต่าง (Using Snapshots)



Visual Basic 6.0 และ การใช้ Snapshot ต่าง (Using Snapshots)
ใน Visual Basic 6.0 Snapshot เป็นชื่อที่มีความหมายเป็นภาพหรือสำเนาข้อมูลในกลุ่มเรคอร์ด (Recrodset) ที่เวลาใดเวลาหนึ่งโดยเฉพาะ
Snapshot คล้ายกับ Dynaset ตรงที่สร้างจากตารางต่างๆ, การใช้คำสั่งของ SQL, หรือ จาก QueryDef, dynaset หรือ snapshot อื่น snapshot ต่างจาก dynaset ตรงที่มันไม่สามารถปรับปรุงได้
ตัวอย่าง Source Code ต่อไปนี้ ได้แสดงวิธีการสร้างกลุ่มเรคอร์ด (Record) ประเภท Snapshot เอาไว้คือ
Set ThisRS=ThisDB.OpenRecordset(sSQL,dbOpenSnapshot)
*** Snapshot จะนำข้อมูลในแต่ละเรคอร์ดออกมาแสดงได้เร็วกว่า Dynaset เพราะว่า snapshot จะใช้วิธีสำเนาข้อมูล แต่ dynaset จะใช้วิธีกำหนดพอยน์เตอร์ (pointer) ชี้ไปที่ข้อมูล
Snapshot  ไม่สามารถปรับปรุง recordset
***เราควรใช้ snapshot ส่งกลับกลุ่มเรคอร์ดเล็กๆเท่านั้น เพื่อไม่ให้เกิดปัญหากับหน่วยความจำต่างๆ
การติดตั้ง snapshot (Setting Up a Snapshot) เราสามารถสร้าง snapshot โดยการกำหนดออปเจ็คต์ Recordset กับคำสั่ง Dim
แล้วใช้ เมธอด OpenRecordset พร้อมพารมิเตอร์ dbOpenSnapshot เพื่อกำหนดเรคอร์ดต่างๆให้ออปเจ็คต์ dynaset จะอนุญาตท่านสามารถระบุพารามิเตอร์ต่างๆในเมธอด OpenRecordset ดังนี้
dbDenyWrite   ป้องกันผู้ใช้อื่นๆ ไม่ให้เขียนลงใน dynaset ในขณะที่เราเปิดใช้งานอยู่
dbForwardOnly สนับสนุนให้เลื่อนผ่าน snapshot ไปข้างหน้าเท่านั้น
dbSQLPassThrough ผ่านคำสั่งของ SQL ที่ใช้สร้าง snapshot ไปให้ฐานข้อมูลของ ODBC เพื่อดำเนินการ

Visual Basic 6.0 และ การใช้ กลุ่ม Record ที่เลื่อนไปข้างหน้าเท่านั้น

Visual Basic 6.0 และ การใช้ กลุ่ม Record ที่เลื่อนไปข้างหน้าเท่านั้น
กลุ่ม Record ที่เลื่อนไปข้างหน้าเท่านั้น จัดได้ว่าเป็น snapshot ประเภทหนึ่ง ที่อนุญาตให้เลื่อนผ่านเรคอร์ดต่างๆ ไปข้างหน้าได้อย่างเดียวเท่านั้น อันนี้หมายความว่า ท่านใม่สามารถใช้เมธอด MoveFist, MovePrevious, Find ทำงานบน Recordset ดังกล่าว
งานลักษณะนี้เหมาะสำหรับใช้รายงานสารสนเทศต่างๆอย่างรวดเร็ว
การกำหนดให้ Rcordset ให้เลื่อนไปข้างหน้าอย่างเดียวเท่านั้น ท่านจะต้องใช้เมธอด Open Recordset และระบุค่าคงที่ dbOpenForwardOnly ดังนี้
Set ThisRS =ThisDB.OpenRecordset(sSQL, dbOpenForwardOnly)


Visual Basic 6 และการใช้ Dynaset ต่างๆ (Using Dynasets)



Visual Basic 6 และการใช้ Dynaset ต่างๆ (Using Dynasets)
Dynaset  เป็นสารสนเทศจากหนึ่งหรือมากกว่าหนึ่งตารางในฐานข้อมูล สารสนเทศนี้ประกอบด้วยฟิลด์ต่างๆ ที่เลือกจากตารางต่างๆ ตามเงื่อนไขที่ระบุ
Dynaset จะกำหนดที่อยู่ของเรคร์ดต่างๆ ในตาราง เมื่อ Dynaset ถูกสร้างขึ้น Dynaset จะช่วยให้ผู้ใช้สามารถปรบปรุงเรคอรดต่างๆ แล้วบรรจุไว้ในฐานข้อมูล อย่างไรก็ตามไม่สามารถเพิ่มหรือลบเรคอร์ดที่ดำเนินการโดยผู้ใช้อื่นหรือโปรแกรมอื่นโดยอัตโนมัติภายหลังที่ Dynaset  ได้ถูกสร้างขึ้น ดังนั้น Dynaset ต่างๆจะมีประโยชนน้อยสำหรับบางแอพพลิเคชั่นที่ใช้งานหลายคน
การติดตั้ง Dynaset (Setting Up a Dynaset) : การติดตั้ง Dynaset สำหรับใช้ภายในโปรแกรมท่านจำเป็นต้องกำหนด Recordset พร้อมกับคำสั่ง dim แล้วสร้าง Dynaset โดยการใช้เมธอด OpenRecordset พร้อมกับพารามิเตอร์ dbOpenDynaset
เมื่อท่านกำลังสร้าง Dynaset ส่วนคีย์ของเมธอด OpenRecordset เป็นคำสั่งของ SQL ซึ่งกำหนดเรคอร์ดต่างๆ ตามที่ต้องการ
เงื่อนไขของตัวกรอง (Filter), เงื่อนไขของการเรียงลำดับ, และเงื่อนไขการเชื่อมโยงกันของข้อมูลจากหลายตาราง
โค้ดต่อไปนี้ แสดงวิธีการสร้าง Dynaset โดยการใช้คำสั่ง SQL ระบุเงื่อนไขในการจัดการเรคอร์ดต่างๆ
Dim ThisDb as Database
Dim ThisRs As Recordset
Dim sSQL As String
Set ThisDB=OpenDatabase(“Biblio.md”)
sSQL=”SELECT*FROM titles WHERE title<=’J’ ORDER BY title”
Set ThisRS=ThisDB.OpenRecordset(sSQL,dbOpenDynaset)
ถ้าต้องการตารางต่างๆ ทั้งหมดในตารางเดียวใน Dynaset ท่านสามารถละเว้นการใช้คำสั่งของ SQL และใช้ชื่อตาราง title ดังนี้
Dim dbBusiness As Database
Dim rsSales As Recordset
Set rsSales =dbBusiness.OpenDatabase(“titles”)
*** การใช้คำสั่ง SQL เป็นความคิดที่ดี ในกรณีที่ท่านต้องการปรับปรุงเรคอร์ดต่างในภายหลัง
เมื่อเราสร้าง Dynaset เราสามารถใช้คำสั่งของ SQL เลือกเรคอร์ดต่างๆ เรายังสามารถระบุเงื่อนไขต่างๆที่มีผลกระทบต่อพฤติกรรมของ Dynaset ได้ดังนี้
พารามิเตอร์                               กิจกรรม
DbDenyWrite                            ป้องกันผู้ใช้อื่นๆ ไม่ให้เขียนลงใน Dynaset ขณะที่เราเปิดใช้งาน
dbReadOly                                ป้องกันเราไม่ให้เปลี่ยนแปลง Dynaset
dbAppendOnly                          ช่วยเพิ่มเรคอร์ดใหม่ต่างๆ แต่ป้องกันเราจากการอ่านหรือปรับปรุงเรคอร์ดต่างๆ ที่ได้สร้างไว้แล้ว
dbSQLPassThrough                  ผ่านคำสั่งของ SQL ที่ใช้สร้าง Dynaset ไปให้เซิร์ฟเวอร์ของฐานข้อมูลของ ODBC เพื่อดำเนินการ
Source code ต่อไปนี้ เป็น ตัวอย่างแสดงวิธีการสร้าง Recordset ประเภท Dynaset ที่อนุญาตผู้ใช้อ่านสารสนเทศในฐานข้อมูลได้อย่างเดียวเท่านั้น
Dim dbBusiness  As Database
Dim rsSales As Recordsed
Set dbBusiness=OpenDabase(“Biblio.mdb”)
Set rsSales=dbBusiness.OpenRecordset(“SELECT * FROM titles”, _ dbOpenDynaset, dbReadOnly)
*** เซิร์ฟเวอร์ (Server) ของ ODBC เป็นกลไกของฐานข้อมูล เช่น Microsoft SQL Server หรือ Oracle ที่สอดคล้องกับ ODBC (Open Database Connectivity) มาตรฐาน วัตถุประสงค์ของเซิร์ฟเวอร์ก็เพื่อดำเนินการเชื่อมโยงแบบสอบถามในเซิร์ฟเวอร์ และส่งกลับไปยังคอมพิวเตอร์ลูกข่าย (client) เฉพาะผลลัพธ์ต่างๆ ของแบบสอบถาม, ไดรเวอร์ (Driver) ต่างๆ ของ ODBC ซึ่งปกติจะเขียนด้วยเจ้าของกิจการกลไกฐานข้อมูล เพื่อใช้เชื่อมโยงระหว่าง Visual Basic และเซิร์ฟเวอร์ของฐานข้อมูล ขณะนี้ ODBC มีความก้าวหน้ามาก ท่านสามารถใช้เชื่อมโยงไปยังสารสนเทศบนเซิร์ฟเวอร์ต่างๆ ของฐานข้อมูล โดยไม่ต้องทราบการทำงานภายในกลไกนั้นๆ
ท่านสามารถสร้าง Dynaset จาก Dynaset อื่น และยังสามารถใช้ Properties Filter และ Sort ของ Dynaset แรกระบุเรคอร์ดต่างๆ ที่ต้องการและแสดงตามเงื่อนไขต่างๆของ Dynaset ที่สอง
Source code ต่อไปนี้ เป็นตัวอย่างวิธีการสร้าง Dynaset จากตารางลูกค้าให้ Mailling list Dynaset ที่สองสร้างขึ้นเฉพาะลูกค้าที่อาศัยอยู่ใน Tennessee และเรียงลำดับตามรหัสไปรษณีย์ ดังนี้
Dim dbMailList As Database
Dim rsCustomer As Recordset
Dim rsTenCust As Recordset
Set dbMailList =OpenDatabase(“sDBLocation”)
Set rsCustomer=dbMailList.OpenRecordset(“Customers”), dbOpenDynaset)
rsCustomers.Filter=”state=’TN’ “
rsCustomers.Sort=”ZIPS”
สองคำสั้งท้ายสุด ได้สร้าง Dynaset ที่สองพร้อมระบุสารสนเทศที่ต้องการต่างๆจาก dynaset แรก ทำให้ dynaset ที่สองแสดงลูกค้าทั้งหมดจาก Tennessee ได้รวดเร็วมาก
                

Wednesday, August 28, 2013

Visual Basic 60 การปรับปรุงคุณลักษณะที่แกนองค์ประกอบโดยรอบของกราฟ

Visual Basic 6.0 กับ Crytal Report 9.2 และ การปรับปรุงคุณลักษณะที่แกนองค์ประกอบโดยรอบของกราฟ
เนื่องจากกราฟออบเจ็กต์ ได้ถูกออกแบบมาสำหรับกราฟเกือบทุกชนิด ดังที่เราทราบมาแล้วที่คุณลักษณะ GraphType ดังนั้นจึงได้เตรียมแกนมาให้สำหรับทุกแกน เพื่อให้เราปรับปรุง แกนที่สามารถให้ปรับปรุงมีทั้งหมด 4 แกนด้วยกัน กราพบางกราฟไม่สามารถใช้ได้ครบทุกแกน อย่างเช่น กราฟแท่งธรรมดจะใช้เพียง 2 แกนเท่านั้นเป็นต้น สำหรับแกนทั้งสี่มีดังต่อไปนี้คือ
แกน DataAxis เป็นแกนหลักที่ใช้คำนวณเพื่อสร้างเป็นขนาดของกราฟที่ประเภทต่างๆ ของอีกแกนหนึ่ง เป็นแกนที่ใช้กับทุกกราฟ ถ้าเป็ฯกราฟสองมิติจะเป็นแกน Y แต่ถ้าเป็นสามมิติจะเป็นแกน Z เป็นแกนที่สร้างจากการเพิ่มฟิลด์ ที่มีคุณลักษณะ SummaryFields ดังแสดงในรูปหน้าถัดไป

แกน GroupAxis เป็นแกนที่สำหรับจัดกลุ่ม เพื่อแสดงกราฟ มักเป็นข้อมูลที่มาจากการจัดกลุ่มที่ฟิลด์ใดฟิลด์หนึ่งหรือเป็นข้อมูลที่มาจากการเพิ่มฟิลด์ที่คุณลักษณะ ConditionFields ถ้าเป็นกราฟสองมิติ จะเป็นแกน x แต่ถ้าเป็นกราฟสามมิติจะเป็นแกน X หรือY ดังแสดงในรูปหน้าถัดไป

แกน SeriesAxis เป็นแกนที่ใช้สำหรบกราฟสามมิติ ดังนั้นจึงเป็นแกนที่สร้างจากการเพิ่มฟิลด์เป็นลำดับที่ 2 ที่คุณลักษณะ ConditionFields หรือที่คุณลักษณะ SummaryFields เป็นแกน X หรือ Y

แกน Data2Axis เป็นแกนสำรอง สำหรับใช้กับการสร้างกราฟที่ต้องอาศัยแกนทั้งสี่ หรือ กราฟที่เป็นชุดหรือหลายๆกราพ เป็นแกนที่สร้างจากการเพิ่มฟิลด์เป็นลำดับที่ 3 ที่คุณลักษณะ ConditionFields หรือที่คุณลักษณะ SummaryFields

สำหรับกราฟสามมิติ และข้อความประกอบที่แกนต่างๆ ที่มีดังต่อไปนี้คือ DataTitle เป็นข้อความประกอบแกน DataAxis ที่เป็นแกนตั้ง GroupTitle เป็นข้อความประกอบแกน GroupAxis และ SeriesTitle เป็นข้อความประกอบแกน SeriesAxis ข้อความประกอบแกนนี้ เราสามารถกำหนดเองให้เป็นข้อความใดๆ ตามที่ต้องการได้ ตลอดจนเส้นหน่วยหลักหรือหน่วยย่อยที่ประกอบแกนทั้งสี่ ดังนี้คือ
DataGridline เป็นเส้นหน่วยหลักหรือ หน่วยย่อยที่ประกอบแกน DataAxis, GroupGridline เป็นเส้นหน่วยหลักหรือหน่วยย่อยที่ประกอบแกน GroupAxis และ SeriesGridline เป็นเส้นหน่วยหลักหรือหน่วยย่อยที่ประกอบแกน SeriesAxis ดังแสดงในรูปที่ผ่านมา เส้นเหล่านี้เราสามารถกำหนดให้แสดงเส้นหรือไม่ก็ได้ หรือให้แสดงเส้นหน่วยหลักอย่างเดียว ไม่แสดงเส้นหน่วยย่อยก็ได้ จากการปรบปรุงคุณลักษณะ
    นอกจากนี้แล้ว ยังมีข้อความที่ใช้แสดงประกอบประเภทของกราฟ ซึ่งข้อความนี้ มักจะสร้างจากการจัดกลุ่มและนำชื่อกลุ่มมาแสดงให้ ที่เราไม่สามารถไปเปลี่ยนแปลงได้เลย ซึ่งข้อความนี้ มักจะสร้างจากการจัดกลุ่มและนำชื่อกลุ่มมาแสดงให้ ที่เราไม่สามารถไปเปลี่ยนแปลงได้เลย แต่เราสามารถปรับปรุงคุณลักษณะเพื่อเลือกแบบอักษรที่ใช้ได้ ซึ่งมีดังต่อไปนี้ Serieslabel เป็นข้อความแสดงหน่วยบนแกน GroupAxis และ GroupLabel เป็นข้อความประกอบหนวยบนแกน SeriesAxis

DataAxisDivisionMethod, Data2AxisDivisionMethod, GroupAxisDivisionMethod,SeriesAxisDivisionMethod เป็นคุณลักษณะสำหรับกำหนดรูปแบบการกำหนดระยะห่างของสเกลของแก่นทั้งสี่ชนิด มีค่าเป็นตัวเลขสองตัวเลขคือ 0 ที่มีค่าเป็นตัวแปรคงที่เป็น crAutomaticDivision สำหรับแบบอัตโนมัติ และเป็นค่าเริ่มต้น และตัวเลข 1 ที่มีค่าตัวแปรคงที่เป็น crManualDivision สำหรับกำหนดเอง

DataAxisDivisionNumber, Data2AxisDivisionNumber, GroupAxisDivisionNumber, SeriesAxisDivisionNumber เป็นคุณลักษณะสำหรับกำหนดระยะสเกล มีค่าเป็นตัวเลข และคุณลักษณะนี้จะมีผลก็ต่อเมื่อ ได้กำหนดคุณลักษณะที่แล้วเป็น 1 คือ กำหนดเอง

DataAxisGridline, Data2AxisGridline, GroupAxisGridline, SeriesAxisGridline
เป็นคุณลักษณะสำหรับกำหนดขนาดของเส้นระยะสเกล ที่มีขนาดตั้งแต่ไม่กำหนดเส้น จนถึงขนาดหนามากที่สุด ดึงต่อไปนี้
crNoGridlines 0
crMinorGridlines 1
CrMajorGridlines 2
crMajorAndMinorGridlines 3

DataAxisNumberFormat, Data2AxisNumberFormat, GroupAxisNumberFormat, SeriesAxisNumberFormat, DataValueNumberFormat เป็นคุณลักษณะสำหรับกำหนดรูปแบบการแสดงตัวเลขที่แกนทั้งสี่ ที่มีรูปแบบตั้งแต่กำหนดจำนวนจุดทศนิยม รูปแบบทางการเงิน และหน่วย มีค่าเป็นตัวเลขดังแสดงในตารางดังต่อไปนี้
crNoDecimal 0
crOneDecimal 1
crTwoDecimal 2
crCurrencyNoDecimal 3
crCurrencyTwoDecimal 4
crPercentNoDecimal 5
crPercentOneDecimal 6
crPercentTwoDecimal 7
crCustomNumberDecimal 8
crThousandsNoDecimal 9
crMillionsNoDecimal 10
crCurrencyThousands 11
crCurrencyMillions 12

DataLabelFont, Data2LabelFont, GroupLabelFont, SeriesLabelFont เป็นคุณลักษณะสำหรับกำหนดแบบอักษรที่แดงที่ DataLabel, Data2Label, GroupLabel และ SeriesLabel

DataTitle, Data2Title, GroupTitle, SeriesTitle เป็นคุณลักษณะสำหรับกำหนดข้อความประกอบแกนทั้งสี่ที่ได้กล่าวไปแล้ว มีค่าเป็นข้อความที่ต้องการแสดงประกอบแกน

DataTitleFont, Data2TitleFont, GroupTitleFont, SeriesTitleFont, SeriesLabelFont เป็นคุณลักษณะสำหรับกำหนดแบบอักษรของข้อความบนแกนทั้งสี่ ในคุณลักษณะที่แล้ว ถ้าหากต้องการใช้ภาษาไทย ให้เลือกแบบอักษรที่รับกับภาษาไทยก็ได้เช่น Angsana New หรือ Cordia New เป็นต้น

Title เป็นคุณลักษณะสำหรับกำหนดข้อความที่เป็นหัวข้อของกราฟ มีค่าเป็นข้อความที่ต้องการให้แสดง
Subtitle เป็นคุณลักษณะสำหรับแสดงข้อความถัดลงมาจากข้อความหัวข้อของกราฟ มีค่าเป็นข้อความที่ต้องการ
TitleFont, SubTitleFont เป็นคุณลักษณะสำหรับกำหนดแบบอักษร แก่ข้อความหัวกราฟและข้อความถัดมา ถ้าหากต้องการใช้ภาษาไทย ให้เลือกแบบอักษรที่รับกับภาษาไทยได้
xAxisTitle เป็นคุณลักษณะสำหรับแสดงข้อความบนแกน x มักเป็นข้อความเดียวกับข้อวความในคุณลักษณะ GroupTitle

Y2AxisTitle เป็นคุณลักษณะสำหรับแสดงข้อความบนแกน Y แกนสำรอง มักเป็นข้อความเดียวกับข้อความในคุณลักษณะ SeriesTitle หรือ Data2Title

YAxisTitle เป็นคุณลักษณะสำหรับแสดงข้อวความบนแกน Y มักเป็นข้อความเดียวกับข้อความในคุณลักษณะ DataTitle

ZAxisTitle เป็นคุณลักษณะสำหรับแสดงข้อความบนแกน Z มักเป็นข้อความเดียวกับข้อความในคุณลักษณะ SeriesTitle หรือ Data2Title
 
   การกำหนดคุณลักษณะค่าเริ่มแรก (Default) แก่ข้อความบนแกน หรือ ที่หน่วยของแกน โดยจะมีคุณลักษณะดังรายการต่อไปนี้คือ IsData2TitleByDefault,IsDataTitleDefault, IsFootnoteByDefault, IsGroupTitleByDefault, IsSeriesTitleByDefault, IsSubTitleByDefault, IsTitleByDefault, IsXAxisTitleByDefault, IsYAxisTitleByDefault, IsZAxisTitleByDefault ทั้งหมดมีค่าเป็นจริงหรือเท็จ และมีค่าเริ่มต้นเป็นจริง คือให้มีการกำหนดข้อความบนแกนเหล่านี้เอง แต่เราสามารถเปลี่ยนแปลงข้อความนี้ ในภายหลังได้

MaxDataAxisValue, MaxData2AxisValue, MaxSeriesAxisValue เป็นคุณลักษณะสำหรับกำหนดค่าสูงสุดให้กับแกนที่สามารถแสดงค่าได้ หากไม่มีการกำหนดจะมีค่าเป็นศูนย์ และเป็นค่าเริ่มแรก คือให้กำหนดค่าเองตามข้อมูล

MinDataAxisValue, MinData2AxisValue, MinSeriesAxisValue เป็นคุณลักษณะสำหรับกำหนดค่าต่ำสุดให้กับแกนที่สามารถแสดงค่าได้ หากไม่มีการกำหนดจะมีค่าเป็นศูนย์ และเป็นค่าเริ่มแรก คือให้กำหนดค่าเองตามข้อมูล

LegendFont เป็นคุณลักษณะสำหรับกำหนดแบบอักษร แก่ข้อความใน Legend ที่แสดงตัวอย่างของกราฟในแต่ละประเภทที่มักจะแสดงที่ด้านซ้ายมือของกราฟ

LegendLayout เป็นคุณลักษณะสำหรับกำหนดรูปแบบการแสดงข้อมูลใน Legend ที่ใช้กับกราฟวงกลมเท่านั้น เช่น ให้แสดงผลรวมข้อมูลของแต่ละประเภท หรือแสดงร้อยละของแต่ละประเภท หรือแสดงทั้งสองแบบ

LegendPosition คือ คุณลักษณะสำหรับกำหนดตำแหน่งการวางของ Legend ซึ่งตามปกติจะมีตำแหน่งเริ่มแรกที่ด้านขวามือ  แต่ถ้าเราต้องการให้วางไว้นอกเหนือจากนี้ ก็สามารถเลือกวางได้อีกสามตำแหน่ง คือ ด้านบน ด้านล่าง และด้านซ้ายมือ โดยมีค่าตัวแปรคงที่หรือตัวเลข

FootNote เป็นคุณลักษณะสำหรับกำหนดข้อความที่จะไปปรากฏที่ด้านล่างมุมขวามือของกราฟ
FootNoteFont เป็นคุณลักษณะสำหรับกำหนดแบบอักษระ สำหรับ FootNote ถ้าต้องการให้แสดงภาษาไทย ให้เลือกแบบอักษรที่สามารถแสดงภาษาไทยได้
GraphColor เป็นคุณลักษณะสำหรับกำหนดให้กราฟแสดงกราฟสี หรือให้แสดงกราฟขาวดำ มีค่าเป็นตัวเลขหรือตัวแปรคงที่ดังนี้คือ ค่าตัวแปรคงที่ crColorGraph ที่มีค่าเป็น 0 สำหรับให้กราฟแสดงกราฟสี และค่าตัวแปรคงที่ crBlackAndWhiteGraph ที่มีค่าเป็น 1 สำหรับให้กราฟแสดงกราฟขาวดำ โดยมีค่าเริ่มต้นที่กราฟสี
GraphDirection เป็นคุณลักษณะสำหรับกำหนดทิศทางของกราฟที่มีอยู่สองทิศทางคือในแนวตั้งและในแนวนอน มีค่าเป็นตัวเลข หรือตัวแปรคงที่ดังนี้คือ ค่าตัวแปรคงที่ crHorizontalGraph ที่มีค่าเป็น 0 สำหรับให้กราฟแสดงในแนวนอน และ ค่าตัวแปรคงที่ crVerticalGraph ที่มีค่าเป็น 1 สำหรับให้กราฟแสดงในแนวตั้ง โดยมีค่าเริ่มต้นที่แสดงกราฟแนวตั้ง
EnableAutoScalDataAxis, EnableAutoScaleData2Axis, EnableAutoScaleSeriesAxis เป็นคุณลักษระที่ให้สร้างสเกลบนแกนทั้งสามแบบอัตโนมัติหรือไม่ มีค่าเป็นจริงเท็จ ปกติมีค่าเริ่มต้นที่เป็นจริง
EnableShowLegend เป็นคุณลักษณะที่ให้สร้างแสดง Legend ที่แสดงประเภทกราฟหรือไม่ มีค่าเป็นจริงเท็จ ปกติมีค่าเริ่มต้นเป็นจริง
DataPoint เป็นคุณลักษณะสำหรับแสดงข้อมูลบนตัวกราฟแต่ละประเภท เพื่อประกอบการแสดงกราฟ ที่มีการแสดงสามรูปแบบตั้งแต่ไม่มีการแสดงข้อมูล ไปจนถึงการแสดงข้อมูลบนตัวกราฟชนิดต่างๆที่มีทั้งหมดสามตัวเลือก มีค่าเป็นตัวแปรคงที่หรือตัวเลขคงที่ดังต่อไปนี้ crName ที่มีค่าเป็น 0 สำหรับไม่แสดงข้อมูล และเป็นค่าเริ่มต้น crShowLabel ที่มีค่าเป็น 1 สำหรับแสดงชื่อกลุ่มของประเภทกราฟและ crShowValue ที่มีค่าเป็น 2 สำหรับแสดงค่าของกลุ่มที่นำมาสร้างกราฟแต่ละประเภท
PieSize เป็นคุณลักษณะสำหรับกำหนดขนาดของกราฟวงกลม โดยมีขนาดให้เลือกทั้งหมดสี่ขนาด ตามค่าตัวแปรคงที่และค่าตัวเลขดังตารางต่อไปนี้ ปกติมีค่าเริ่มต้นที่ crLargePieSize
ViewingAngle เป็นคุณลักษณะสำหรับกำหนดมุมมองลงมาบนกราฟ เป็นมุมที่มองจากด้านบน มาจนถึงมุมมงขึ้น เป็นคุณลักษระที่ใช้กับกราฟสามมิติ โดยมีค่าเป็นตัวเลขที่แทนมุมมองที่ระดับต่างๆทั้งหมด 16 มุมมอง มีค่าเริ่มต้นที่ค่าตัวแปรค่าคงที่ crStandardView ที่มีค่าตัวเลขเป็น 1 โดยมีตัวอย่างมุมมอง ค่าตัวแปรคงที่และตวเลข
HasDropShadow เป็นคุณลักษณะสำหรับแสดงแสงเงาที่ขอบของออบเจ็กต์กราฟ โดยจะต้องกำหดให้แสดงขอบออบเจ็กต์ประกอบด้วย มีค่าเป็นจริงหรือเท็จ
MarkerShap เป็นคุณลักษณะสำหรับแสดงจุด ที่ตัดกับเส้น Grid หรือเส้นสเกลที่มักใช้กับกราฟเส้นตรงต่างดังแสดงในรูป ที่เราสามารถเลือกรูปร่างของ Marker ได้อีก 4 รูปร่าง ตั้งแต่รูปวงกลม รูปสี่เหลี่ยมสามเหลี่ยมปกติมีค่าเริ่มต้นที่มีรูปร่างสี่เหลี่ยม มีค่าเป็นตัวเลขและตัวแปรคงที่ดังแสดงต่อไปนี้
crRegtangleShape 1 เท่ากับ สี่เหลี่ยม
crCircleShape 4 เท่ากับ วงกลม
crDiamondShape 5 เท่ากับ ดาว
crTriangleShape 8 สามเหลี่ยม
MarkerSize เป็นคุณลักษณะสำหรับกำหนดขนาดของ Marker ที่แตกต่างกันตั้งแต่ขนาดเล็กสุด ไปจนถึงขนาดใหญ่สุด โดยมีขนาดให้เลือก 5 ขนาด มีค่าเป็นตัวเลขเรียงตั้งแต่ขนาดเล็กสุด ไปจนถึงขนาดใหญ่สุด ปกติจะกำหนดขนาดที่มีค่าตัวเลขเป็น 2 มีค่าตัวแปรคงที่เป็น crMediumMarker
crSmallMarkers 0
crMediumSmallMarkers 1
crMediumMarkers 2
crMediumLargeMarkers 3
crLargeMarkers 4

Width, Heigh เป็นคุณลักษณะที่เราคุ้นเคยมาอย่างดี เนื่องจากเป็นคุณลักษณะสำหรับกำหนดขนาดของออบเจ็กต์ทุกออบเจ็กต์สำหรับการแสดงกราฟนี้ การกำหนดขนาดจากคุณลักษณะทั้งสองนี้เป็นเรื่องจำเป็น ถ้าหากเราเขียนโปรแกรม โดยไม่กำหนดขนาดแล้วอาจจะได้กราฟที่เล็กเกินไป ดังนั้นในการเขียนโปรแกรมสร้างกราฟออบเจ็กต์ควรกำหนดขนาดด้วย


Saturday, March 2, 2013

การใช้ array ใน vb.net

ตัวอย่างการใช้ array โดยการประกาศตัวแปร เข้าถึง class arraylist
Module Module1

    Sub Main()
 Dim list As New ArrayList
' เข้าถึง class arraylist 
' กำหนดค่า string 3 ตัวให้กับตัวแปร list ซึ่งเป็นตัวแปรชนิด array
 list.Add("back")
list.Add("To")
list.Add("The Room")
    End Sub

End Module
 ลองเอาไปทำดู
คราวหน้าจะมาแนะนำตัวอย่างการใช้งาน array ที่มากขึ้นกว่าเดิมน่ะ
รอติดตามกัน

Saturday, February 25, 2012

Database applications that use a lookup table.

Database applications that use a lookup table. For example, you might have a table with the records with the state. The value in this field must come from the United States StateAbbrev in a lookup table. This program will take time and create a table such as the State concerned.
Enter the name of the database tables and data (that is, the state), lookup tables and fields (State, StateAbbrev), and the relationship that should be tied to the table. (Leave blank if you do not want to build a relationship).
When you click the button. 'The program is open to the database. It removed any relationships, indexes and tables to find out if it was built in the earlier stage.
Next, the code will create a new lookup table and add a field to search. It uses the same data type and size of the field in the table. (Addresses.State).
The field has a lookup table of values ​​should be unique. (It does not make sense to have two records with the "Colorado" in the United States), the program adds a unique index to the search field. (States.StateAbbrev).
This program uses the INSERT INTO statement to copy the values ​​remain the same field. (Addresses.State) to the search field. (States.StateAbbrev) Notice of the [] brackets are necessary only if your name is a reserved word in Access, for example, if you set a table. This is not good practice, and it is better to avoid those keywords. If you are willing to do that, then remove all the brackets and the program will crash if you accidentally use the wrong name.
If you enter a name associated with the many-to-one relationship between the two fields. This relationship allows one to find the field to match the records in the table. That makes sense because a lot of records that are subject to the same state.
If you did not create this relationship, your code can continue to use a lookup table. The list of state permits. The database does not enforce the limit for you....

Wednesday, February 22, 2012

HowTo: Use DAO to make a database lookup table

Database applications that use a lookup table. For example, you might have a table with the records with the state. The value in this field must come from the United States StateAbbrev in a lookup table. This program will take time and create a table such as the State concerned.
Enter the name of the database tables and data (that is, the state), lookup tables and fields (State, StateAbbrev), and the relationship that should be tied to the table. (Leave blank if you do not want to build a relationship).
When you click the button. 'The program is open to the database. It removed any relationships, indexes and tables to find out if it was built in the earlier stage.
Next, the code will create a new lookup table and add a field to search. It uses the same data type and size of the field in the table. (Addresses.State).
The field has a lookup table of values ​​should be unique. (It does not make sense to have two records with the "Colorado" in the United States), the program adds a unique index to the search field. (States.StateAbbrev).
This program uses the INSERT INTO statement to copy the values ​​remain the same field. (Addresses.State) to the search field. (States.StateAbbrev) Notice of the [] brackets are necessary only if your name is a reserved word in Access, for example, if you set a table. This is not good practice, and it is better to avoid those keywords. If you are willing to do that, then remove all the brackets and the program will crash if you accidentally use the wrong name.
If you enter a name associated with the many-to-one relationship between the two fields. This relationship allows one to find the field to match the records in the table. That makes sense because a lot of records that are subject to the same state.
If you did not create this relationship, your code can continue to use a lookup table. The list of state permits. The database does not enforce the limit for you....

This language was developed from the BASIC language.

Visual Basic (English: Visual Basic) or VB as a GUI application created by Microsoft. This language is one of the most popular programming language for use in business applications.

This language was developed from the BASIC language. The VB.NET language was developed with Visual Basic support for Rapid Application Development (RAD) development and application graphical user interface (GUI), to access the database using the connection. DAO, RDO, or ADO, and ActiveX control to create another unique feature of the Visual Basic programmer is able to bring many applications together in a single application program. It can also be applied to components of Visual Basic has been provided as well.

Visual Basic 2010 Teach Yourself in 24 hours

Sams Teach Yourself Visual Basic 2010 in 24 Hours Complete Starter Kit (Sams Teach Yourself -- Hours)

Sams Teach Yourself Visual Basic 2010 in 24 Hours Complete Starter Kit (Sams Teach Yourself -- Hours)
By James Foxall

List Price: $34.99
Price: $21.77 & eligible for FREE Super Saver Shipping on orders over $25. Details

Availability: Usually ships in 24 hours
Ships from and sold by Amazon.com

56 new or used available from $18.00
Average customer review:
(23 customer reviews)

Product Description

Sams Teach Yourself  Visual Basic® 2010 in 24 Hours
James Foxall
STARTER KIT
DVD includes Visual Basic 2010 Express Edition
In just 24 sessions of one hour or less, you’ll learn how to build complete, reliable, and modern applications with Visual Basic 2010. Using this book’s straightforward, step-by-step approach, you’ll master the entire process, from navigating VB 2010 to deploying finished solutions. You’ll learn how to write efficient object-oriented code; build superior user interfaces; work with graphics, text, and databases; and even control external applications. Each lesson builds on what you’ve already learned, giving you a strong, practical foundation for success!
Step-by-step instructions carefully walk you through the most common Visual Basic 2010 tasks.
Quizzes and Exercises at the end of each chapter help you test your knowledge.
By the Way notes present interesting information related to the discussion.
Did You Know? tips offer advice or show you easier ways to perform tasks.
Watch Out! cautions alert you to possible problems and give you advice on how to avoid them.
Learn how to…
  • Navigate the VB 2010 environment and use VB’s powerful new tools
  • Work with objects, collections, and events
  • Build attractive, highly functional user interfaces
  • Make the most of VB 2010’s advanced controls
  • Create efficient modules and reusable procedures
  • Store data, make decisions in code, and use loops to improve efficiency
  • Use powerful object-oriented programming techniques
  • Interact effectively with users
  • Work with graphics, text files, and databases
  • Debug and troubleshoot applications
  • Manipulate external applications, file systems, and the Windows Registry
  • Distribute the software you’ve created
James Foxall is President of Tigerpaw Software, Inc., a 25 year old commercial software company with more than 25,000 users. He is a leading authority on interface and behavior standards for Windows and Office environments and is an expert on improving business processes through technology. He contributes to several journals and magazines, speaks internationally, teaches college courses on Visual Basic, and has been featured widely in print and online media for his technology expertise.
DVD Includes: Microsoft® Visual Basic 2010 Express Edition
On the Web: Access code examples from the book, as well as updates, and corrections as they become available at informit.com/title/9780672331138
  

Product Details

  • Amazon Sales Rank: #17930 in Books
  • Published on: 2010-08-18
  • Original language: English
  • Number of items: 1
  • Dimensions: 1.08" h x 7.14" w x 9.26" l, 1.88 pounds
  • Binding: Paperback
  • 528 pages

Editorial Reviews

About the Author James Foxall is VP of Tigerpaw Software, Inc., a Microsoft Certified Partner specializing in commercial database applications. He is responsible for management of all Windows application development, and is an authority on application interface and behavior standards of applications for the Microsoft Windows and Office environments. He contributes to several journals and magazines, speaks internationally, teaches college courses on Visual Basic, and has been featured in news shows, trade publications, and newspaper articles for his technology expertise. James has written numerous books, including the three previous editions of this book. He lives in the Omaha, Nebraska area.

Customer Reviews

Most helpful customer reviews 36 of 36 people found the following review helpful. 5Better than the other book I tried... By John Owens Well, I first started with another book (Mastering VB 2010), but it didn't explain everthing well enough for me to understand. I took C++ 10 years ago in college, but I think it was written for someone with more experience than me. So, I bought this book, and WOW! Much better. Foxall takes the time to explain everything. I am the kind of reader that reads slowly, and makes sure he comprehends every word and sentence. I cannot move on until I'm sure I "get it". So, if you are new to programming, this is the book to buy. I'm planning on finshing this one and the moving on to the other so that I can learn the in-depth stuff a little better. PROs: 1) VERY IMPORTANT - Every step is clearly explained. I CAN'T UNDERESTIMATE THIS FOR THE BEGINNER. I had to reread a couple paragraphs to make sure I clearly understood (e.g. Classes/Controls/Methods/Objects and what each word meant in OOP), but that's because it's complicated, not but because he does a poor job. [note: Before I bought this book, I tried google'ing some of the major terms and couldn't find another person who could state it clearly enough for me to get it. He is FABULOUS in this area; CLEAR EXPLANATIONS WITH EXAMPLES and CODE for you to build and practice with.] 2) There are not any true "I'll tell you later"'s in the book. If there is a "I'll tell you later", he at least explains the concepts, and just promises to explain "further" in later chapters. This is so important for a beginner to be able to follow what's going on. 3) He tells you throughout the text a few times what concepts are not covered in the book because it would be too complicated to explain in 24 hours. I am greatful for people when they set accurate expectations. (Politicians should be required to learn from the examples in this text, hehehe.) 4) He inserts just the right balance of pictures and tangential snippets of infomation to keep you busy, having fun, and clear on what your doing - and he doesn't overdo it. The book is not too WORDY or BUSY, but I feel if he left much of anything out it would leave me longing for more answers to my questions. He's either good at seeing from someone else's point of view, or he had an editor without programming experience to help him make sure we readers didn't get lost - I CAN'T UNDERESTIMATE THIS ONE EITHER! This is absolutely ESSENTIAL in a book for beginners. 5) Has all the example/practice code on the publisher's website. This is soooooo necessary for "dummies" or for people who complete the exercises and forget to save! Other books have it to, but I still felt I had to make sure you knew that it was available. CONs: You know, I have to be honest. I have no cons to list, but that may be because I don't know enough to complain. But, nonetheless, until I become an experienced programmer, I just don't have any regrets. Kudos to the author and publisher, and I hope to read their C++ book next, so I can compare the two languages for myself. Good luck to all you beginners! 15 of 16 people found the following review helpful. 5Buy this book now! By W. Hansen I'm reading this book on Kindle for PC. It's really easy to have this open on screen and work in Visual Basic at the same time. I havent tried programming since the mid 90's. Back then it was C+ and I eventually gave up because it took so long to learn and all the lessons seemed so abstract. I am learning so much faster with this book and am excited about programming again. I have already written a useful app (Not Calculator) and I have only owned the book for 2 days. I highly reccommend this book to any begginers like me. 7 of 7 people found the following review helpful. 5The best VB.Net book written By Joseph Davoli I have been programming with VB since 1993 and am a MCSD in Visual Studio 6.0. When .NET came on the scene, all of the VB.NET books were, in my opinion, very poor. I purchased this book on the strength of the Amazon reviews, and I am more than satisfied. I read the book and built all of the sample projects in thirteen days -- roughly two chapters per day (less than two hours each day). The projects are very practical and cover all of the topics that any programmer needs to know in order to build a complete, polished application. At the same time that I purchased this book, I also purchased the Murach VB 2010 book (I already had the Murach VB 2008 book). It is about 800 pages, but each opposite facing page simply restates in a slightly different way what was stated in the left page. It will be a nice reference, but VB 2010 in 24 Hours is the one that I will turn to whenever I begin a VB project. Before I purchased this book, I had already built a VB.NET 2008 application that migrates Domino data to SharePoint. After I read this book, I saw many things that I wish I had used, but did not have the time to consider or figure out. One example of that is this book's simple, effective explanation of how to write to and read from the Registry. Another is this book's coverage of the ClickOnce feature for distributing the programs that you write with VB.NET. Version 3.0 was the breakout version for Visual Basic. That attracted masses of programmers who could and did release professional quality software products. The next few versions of VB were forgettable. When version 6.0 came out, programmers again embraced VB and created even better software. Visual Basic .NET has had, in my opinion, rather limited appeal, but Visual Basic 2010 (and the .NET Framework 4.0) will, I believe, result in yet another wave of quality programs being written and sold. This book has the potential to lead that wave. See all 23 customer reviews...