หน้าเว็บ

วันศุกร์ที่ 6 สิงหาคม พ.ศ. 2553

Database.NET (A MultiDatabase Manager)

โปรแกรมนี้สามารถเชื่อมต่อเข้ากับฐานข้อมูลได้หลากหลายชนิด อาทิ
  • MS-Access
  • MS-Excel
  • dBase
  • FireBird
  • MySQL
  • SQL Server
  • SQL Azure
  • SQL Server CE
  • SQLite
  • PostgreSQL
  • Oracle
  • OLE DB
  • ODBC

รองรับ Syntax Highlight และคำสั่งต่าง ๆ ที่จำเป็นของฐานข้อมูลนั้น ๆ
พัฒนาด้วย .NET(2, 3.5)
สามารถ download ไปใช้ได้ฟรี
ไฟล์โปรแกรมมีไฟล์เดียว ขนาดประมาณ 7 MB. (ไม่จำเป็นต้องติดตั้ง copy, paste ใช้ได้เลย)
ไปที่เว็บไซต์ของผู้พัฒนาโปรแกรม http://fishcodelib.com/Database.htm

PopupTipTimer

เป็น Control ที่ดูคล้าย ToolTip สามารถกำหนดเวลาได้ว่าจะแสดงนานแค่ไหน (เป็น 1/1000 วินาที)
ภาพก่อนแสดง PopupTipTimer

ภาพขณะแสดง PopupTipTimer











ตัวอย่างการใช้งาน


using System;
using System.Drawing;
using System.Windows.Forms;
using Stone.WinUI;

namespace TestPro
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
            this.popupTip = new PopupTipTimer();
            this.popupTip.BackColor = Color.Silver;
        }

        private PopupTipTimer popupTip;

        private void textBox1_Enter(object sender, EventArgs e)
        {
            this.popupTip.ShowDuration(this.textBox1,
                            "Please fill customer name",
                            "Do not leave blank for this field, this is important information.",
                            ToolTipIcon.None,
                            Properties.Resources.User1,
                            8000);
        }
    }
}


Download Source Code: PopupTipTimer.cs

วันพฤหัสบดีที่ 5 สิงหาคม พ.ศ. 2553

Calendar Winforms Control

Screen short

Class Diagram

Update: April 11, 2011 + Demo for VB.Net
Download Here include sourcecode, demo(c#, vb.net)

Modify by : thammapat[at]gmail.com

Job base on : Calendar of Jose Menendez Póo (link to original: http://www.codeproject.com/KB/docview/WinFormsCalendarView.aspx)
Modify date : October 30, 2009
Change Log:

  1. Calendar class
    • Inherit from class Control instead of ScrollableControl.
    • Add vertical scrollbar for DaysMode.Expanded view.
    • Add event 'ItemDrawContent' 
    • Add method 'BeginUpdate' and 'EndUpdate'.
    • Add property 'MultiSelect', 'RendererMode'
    • Add ToolTip component
    • Add Icon
    • Override 'PreProcessMessage' for supported keyboard navigator(left, right, up, down, pageup, pagedown) and editing item(insert, del, escape, f2).
    • Override 'WndProc' to force focus after key down.
    • Change some property name to shortly.
    • Change method 'ScrollCalendar' from move a week -> move a month.
    • Change all event signature to EventHandler style.
    • Adjust FinalizeEditMode.
    • Adjust draw item content.
    • Adjust xml document.
    • Double check before raise event 'ItemDatesChanged' is realy changed.
  2. CalendarItemCollection class
    • Add method 'Sort' when 'CollectionChanged'
  3. CalendarItem class
    • Add Property: ToolTipText, Values, Visible. 
    • Add Method: GetValue, LoadDataRow
    • Implement interface ICloneable
    • Adjust resizing, dragging behavior
  4. CalendarSystemRenderer class
    • Change some color
  5. MonthView class
    • Inherit from class Control instead of ContainerControl.
    • Add Icon
    • Add Method: SetSelectionRange(start, end)
    • Add event 'DateChanged'.
    • Add ContextMenuStrip when mouseup at title Month or Year.
    • Override 'PreProcessMessage' for supported keyboard navigator(left, right, up, down, pageup, pagedown)
    • Override 'WndProc' to force focus after key down.
    • Adjust OnMouseMove when highlighting date[s], event 'SelectionChanged' will be raise after mouse up.
    • Adjust OnMouseDown when clicked at gray text, go to that month.
    • Adjust xml document.
    • Change property name from 'DayGrayedText' -> 'TrailingForeColor'
    • Remove property 'MonthTitleColorInActive', 'MonthTitleTextColorInActive'
Download Here include sourcecode, demo(c#, vb.net)

วันเสาร์ที่ 1 พฤษภาคม พ.ศ. 2553

PHP กับ IIS7 ง่ายมาก ๆ

เมื่อก่อนคนที่ใช้ windows ถ้าจะทำงานกับ php แล้วนอกจากจะต้องโหลด php มาลงแล้ว ก็ต้องตาม set โน่นนี่อีกหลายอย่าง ทีนี้พอเป็น IIS7 ปั๊บ ง่ายเลย เข้าไปที่ http://php.iis.net/ แล้วกดที่ Install PHP แล้วก็ next ๆ ไปเรื่อย ๆ (ติดตั้งผ่าน Web PlatForm) ตัว setup นี้จะโหลดโปรแกรมที่เกี่ยวข้องพร้อมกับ setup ให้ IIS7 ของเราใช้ php ได้เลย

ง่ายจริง ๆ

วันพฤหัสบดีที่ 25 มีนาคม พ.ศ. 2553

.net 2 กับ ActiveControl ที่ขัด ๆ กับที่คิดไว้

เดิมใน .net 1.1 ถ้าเรียกใช้ ActiveControl จะบ่งถึงตัว Control ที่กำลัง Active อยู่ แต่ใน .net 2 จะบอกตามชั้นคือ

Form
 |-- UserControl
       |-- Button

ขณะที่ Button กำลัง Active และเรียก property ActiveControl เราจะได้ค่า "UserControl" แทนที่จะเป็น Button

Work around

Control activeControl = base.ActiveControl;
if (activeControl is IContainerControl)
{
    IContainerControl container = activeControl as IContainerControl;
    activeControl = container.ActiveControl;
}

วันศุกร์ที่ 12 มีนาคม พ.ศ. 2553

ขึ้นบรรทัดใหม่ใน SQL-Transact

วันนี้มีโอกาสต้องเขียน function สำหรับ get ข้อมูลหลาย ๆ table มารวมกันให้เหลือบรรทัดเดียว แต่พอข้อมูลมันมีเยอะเข้าเลยดูยาก ก็เลยอยากจะให้มันแยกบรรทัดด้วย กลับไปดูของเก่า ๆ อ้อ เคยทำไว้แล้ว ม้นต้องเชื่อมด้วย Char(10)+ Char(13) ทีนี้ output มันจะออกมาแบบนี้

1002999393    VISA    2,500.00,
2001029992    MAST  4,225.00,
1000229291    VISA    1,988.25



-- * ฟังก์ชั่น FormatNumber ให้ดูที่ http://www.novicksoftware.com/udfOfWeek/Vol1/T-SQL-UDF-Volume-1-Number-48-formatnumber.htm
-- ==========

Create Function GetMultiLineCreditCardInfo(@docno varchar(30))
Returns varchar(1000)
As
Begin
Declare
@field_Return varchar(1000),
@delimiter varchar(4)

SET @delimiter = ', ' + Char(10)+ Char(13)

Select @field_Return = Coalesce(@field_Return + @delimiter, '')
+ ( IsNull(CreditCardID, '') + ' ' + IsNull(CreditCardType, '') + ' ' + dbo.FormatNumber(NetAmount, '2', ',', 'zero') )

From CreditCard
Where RefDocument = @docno

Return @field_Return

End

วันพฤหัสบดีที่ 11 มีนาคม พ.ศ. 2553

An error occurred while parsing EntityName. Line 2, position 65.


ใน VS2008 พอเปิด project และพยายามจะเปิดฟอร์มที่เคยสร้างไว้จะพบ error นี้ทุกครั้ง ทั้ง ๆ ที่ตอนสร้าง project ก็ปกติดี โดยมีข้อความแจ้งว่า
An error occurred while parsing EntityName. Line 2, position 65.






















พอ search ไปในเน็ต (อ้างอิง VS2005 Beta 2 form designer problem: error while parsing EntityName) พบว่ามีอักษรบางตัวใน path ถูกตีความผิดไปคืออักษร "&"

จากตัวอย่างใน project นี้เก็บอยู่ที่โฟลเดอร์ D:\Downloads\Control Report&Print\Report RDL\RecursiveData\RecursiveData
พอเปลี่ยนชื่อโฟลเดอร์ใหม่เป็น D:\Downloads\Control Report-Print\Report RDL\RecursiveData\RecursiveData

ทุกอย่างก็กลับสู่ปกติ