RSS

เมื่อทำ Installer .NET แล้วต้องการแนบ .NET Framework 3.5 SP1

0 Comments | This entry was posted on Jan 18 2010

ต้องการ ให้แนบไฟล์ .net framework 3.5 sp1 ไปด้วย ดันเกิด error
“The install location for prerequisites has not been set to ‘component vendor’s web site’ and the file ‘DotNetFX35SP1\dotNetFx35setup.exe’ in item ‘.NET Framework 3.5 SP1′ can not be located on disk.”

Read more »

How to copy or editdata from db to db with DataAdapter

0 Comments | This entry was posted on Dec 29 2009

if u want to copy data from table in database with DataAdapter

Dim oleAdapt As OleDbDataAdapter 'source adapter data
Dim adap As OleDbDataAdapter 'destination adapter data
Dim bldr As OleDbCommandBuilder
Dim ds As New DataSet
Dim dsdest As New DataSet

'source data
oleAdapt = New OleDbDataAdapter("SELECT * FROM Table1", _sourceConnStr)
oleAdapt.Fill(ds)

'destination data
adap = New OleDbDataAdapter("SELECT * FROM Table2 where 0 = 1", _desConnStr)
bldr = New OleDbCommandBuilder(adap)
adap.InsertCommand = bldr.GetInsertCommand
adap.Fill(dsdest)

'loop for copy or editdata
For i As Integer = 0 To ds.Tables(0).Rows.Count - 1
Dim r As DataRow = dsdest.Tables(0).NewRow()
For j As Integer = 0 To ds.Tables(0).Columns.Count - 1
r(j) = ds.Tables(0).Rows(i)(j)
Next
dsdest.Tables(0).Rows.Add(r)
Next

'update data to Table2
adap.Update(dsdest)

Mission Complete.

Highlight text inside datagridview.

0 Comments | This entry was posted on Dec 02 2009

good function. if u want highlight text in Datagridview in window application. very thx a lot [_Joe_]
ref : social.msdn.microsoft.com


Private Sub DGV_CellPainting(ByVal sender As Object, ByVal e As DataGridViewCellPaintingEventArgs)

If e.RowIndex >= 0 And e.ColumnIndex >= 0 Then

e.Handled = True
e.PaintBackground(e.CellBounds, True)

'can edit GetSearchWord with keyword for hilight it.
Dim sw As String = GetSearchWord(e.ColumnIndex)
If Not String.IsNullOrEmpty(sw) Then

Dim val As String = DirectCast(e.FormattedValue, String)

Dim sindx As Integer = val.ToLower.IndexOf(sw.ToLower)
If sindx >= 0 Then
'the highlite rectangle
Dim hl_rect As New Rectangle()
hl_rect.Y = e.CellBounds.Y + 2
hl_rect.Height = e.CellBounds.Height - 5

'find the size of the text before the search word
'and the size of the search word
Dim sBefore As String = val.Substring(0, sindx)
Dim sWord As String = val.Substring(sindx, sw.Length)
Dim s1 As Size = TextRenderer.MeasureText(e.Graphics, sBefore, e.CellStyle.Font, e.CellBounds.Size)
Dim s2 As Size = TextRenderer.MeasureText(e.Graphics, sWord, e.CellStyle.Font, e.CellBounds.Size)

'adjust the widths to make the highlite more accurate
If s1.Width > 5 Then
hl_rect.X = e.CellBounds.X + s1.Width - 5
hl_rect.Width = s2.Width - 6
Else
hl_rect.X = e.CellBounds.X + 2
hl_rect.Width = s2.Width - 6
End If

'use darker highlight when the row is selected
Dim hl_brush As SolidBrush
If ((e.State And DataGridViewElementStates.Selected) <> DataGridViewElementStates.None) Then
hl_brush = New SolidBrush(Color.DarkGoldenrod)
Else
hl_brush = New SolidBrush(Color.LightGoldenrodYellow)
End If

'paint the background behind the search word
e.Graphics.FillRectangle(hl_brush, hl_rect)

hl_brush.Dispose()
End If
End If

'paint the content as usual
e.PaintContent(e.CellBounds)
End If
End Sub

ความสุขของปลาทอง

0 Comments | This entry was posted on Nov 29 2009

เคยรู้ไหมว่าปลาทองมันสุข แค่ไหน ว่ายน้ำ แล้วบอก บ๊อบ บ๊อบๆ  พ่อมึง พ่อมึง  ทุกคนที่ผ่านตู้ปลา ถึงเวลาก็กินอึ่มหนำสำราญ… ทำไมถึงรู้ว่าอิ่ม ก็ผมไม่เคยเห็นปลาทองตัวไหนมันขออาหารเพิ่ม หรืออดอาหารประท้วง หนิครับ  แถมป่วยมันก็ไม่เคยบอกเรา…

เคยมีพี่ใน CAP บอกว่าไอคนที่ใครบอกว่าปลาทองอดอาหารได้ยาวนาน เพราะเขามักจะลืม หรือขี้เกียจให้อาหารมัน ก็เลยบอกมันว่าปลาทองอดอาหารได้นาน ทั้งๆ ที่มันอาจจะหิวแต่มันบอกสื่ออะไรเราไม่ได้ จนเราเสียมันไปนั้นหละ ตามความเป็นจริง มันอาจจะอดได้ เหมือนกับคนอดข้าวนั้นหละ แต่มันจะทำอะไรเราได้ละ ?

ดังนั้นความสุขของปลาทอง คือว่ายเวียนไปมา ในตู้อันแสนอบอุ่น รออาหารด้วยตาละห้อยในทุกๆ วัน… แค่ันั้นมันก็มีความสุขแล้ว แล้วเราละต้องการอะไรกับชีวิตมากนัก

Google Map ค้นหาสายรถเมล์ รถไฟฟ้า รถไฟใต้ดิน

0 Comments | This entry was posted on Nov 27 2009

จะเก่งไปแล้วนะ.. สามารถบอกได้อีกว่า ขึ้นรถเมล์สายอะไร ขึ้น mrt ที่ไหนลงที่ไหน ใช้เวลาประมาณกี่นาที .. ตัวอย่าง ต่อไปจะทำอะไรได้อีกไหมเนี้ย หรือว่าไม่ต้องออกนอกบ้าน คลิ๊กเดินๆ แล้วสั่งซื้อของได้เลยผ่านหน้าเว็บ..  ยุคนี้คงต้องบอกว่าอะไรก็เป็นไปได้ ถ้ามี google  ^.^

The differences between LEN and DATALENGTH in SQL

0 Comments | This entry was posted on Oct 27 2009

DATALENGTH returns the length of the string in bytes, including trailing spaces. LEN returns the length in characters, excluding trailing spaces. For example,

SELECT
  LEN('string'),
  LEN('string   '),
  DATALENGTH('string'),
  DATALENGTH('string   '),
  LEN(N'string'),
  LEN(N'string   '),
  DATALENGTH(N'string'),
  DATALENGTH(N'string   ')

will return 6, 6, 6, 9, 6, 6, 12, 18

from Arnold Fribble
Ref : SQLTeam

Insert text to page line in Gridview

0 Comments | This entry was posted on Oct 21 2009

ไปหาเว็บนอกตั้งนาน ของดีอยู่ใกล้ตัวแค่นี้เอง แย่จริงๆ เรา
คงได้ใช้กันอีกแน่ ๆ ขอแปะไว้หน่อยกันหาย

protected void GridView1_RowCreated( object sender , GridViewRowEventArgs e ) {
// ตรวจสอบ ว่าเป็น Pager หรือป่าว
if( e.Row.RowType == DataControlRowType.Pager ) {
//เอา table ออกมาจาก row แบบนี้
Table tb = ( e.Row.Cells[ 0 ].Controls[ 0 ] as Table );
TableCell cell = new TableCell();
cell.Text = "หน้าที่ " ;
//ใส่ column ที่ 0 ให้มันใหม่
tb.Rows[ 0 ].Cells.AddAt( 0 , cell );
//ใส่ column สุดท้ายให้มันใหม่
TableCell cell2 = new TableCell();
cell2.Text = "จากทั้งหมด : " + GridView1.PageCount.ToString() +" หน้า";
tb.Rows[ 0 ].Cells.Add( cell2 );
}
}

จากคุณ tapeza555
ref : GreatFriend

Remove link Treeview ASP.net

0 Comments | This entry was posted on Oct 20 2009

remove link in Treenode
Example code.

TreeNode d = new TreeNode();
d.SelectAction = TreeNodeSelectAction.None;

Regular Expression for .NET

0 Comments | This entry was posted on Oct 12 2009

Lazy to find it again.
http://regexlib.com/CheatSheet.aspx

add Tool for regular expression .net => The Regulator from Roy Osherove

thank you. bye!!! :P

Voo. Surprise!!! Ford Mustang 2010 Keyword

0 Comments | This entry was posted on Oct 12 2009

today. i check status my site in google webmaster tools same everyday. but today i see “Ford Mustang 2010″ Keyword in my keyword list found! . i test search in google thailand and found

Ford Mustang 2010 keywordFord Mustang 2010 keyword

haha. Thaiexpress car in number one result search. Vooo Yeahh!!
Thank you SEO Google. i love u. but status pageview in mysite …