Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.Odbc
Public Class Form1
Public Function ServerTime()
On Error Resume Next
Dim myTime As Date
Dim conn As New OdbcConnection
conn.ConnectionString = strConnectionString
conn.Open()
Dim cmd As New OdbcCommand("SELECT GETDATE() AS CurrentDateTime", conn)
Dim rs As OdbcDataReader
rs = cmd.ExecuteReader()
Dim i As Integer = 0
While rs.Read
myTime = rs("CurrentDateTime")
End While
Return myTime
Exit Function
End Function
end Class
พีเอ็ม คอม แหล่งรวบรวมสาระความรู้ แบ่งปัน และน้ำใจ ในการให้ความรู้ทางด้านคอมพิวเตอร์ อยากรู้อะไรเข้ามาสอบถามได้เลย โปรแกรมฟรี Open Source และอื่น ๆ อีกมากมาย
10 มิถุนายน 2557
09 มิถุนายน 2557
วิธีไปยังบรรทัดสุดท้าย DataGridView (VB.NET)
Private Sub GoToLastRow(ByVal dg As DataGridView)
Dim last As Integer
last = dg.Rows.Count - 1
dg.CurrentCell = dg(0, last)
End Sub
วิธีใช้
GoToLastRow(Datagridview1)
Dim last As Integer
last = dg.Rows.Count - 1
dg.CurrentCell = dg(0, last)
End Sub
วิธีใช้
GoToLastRow(Datagridview1)
วิธีแก้ Error: Saving Changes Not Permitted
ไปที่ Tools -> Options -> Designers -> Table and Database
Designers->
uncheck ที่ Privent saving changes that requiretable re-creation
uncheck ที่ Privent saving changes that requiretable re-creation
04 มิถุนายน 2557
โค้ดสำหรับส่งค่า Tab เมื่อกดปุ่ม Enter (HTML+AJAX)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title> Next Tab DEMO</title>
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<script type='text/javascript'>//<![CDATA[
$(window).load(function(){
$(document).on("keypress", ".TabOnEnter" , function(e)
{
//Only do something when the user presses enter
if( e.keyCode == 13 )
{
var nextElement = $('input[tabindex="' + (this.tabIndex+1) + '"]');
if(nextElement.length )
nextElement.focus();
else
$('input[tabindex="1"]').focus();
}
});
});//]]>
</script>
</head>
<body>
AAA:<input id="AAA" class='TabOnEnter' tabindex="1" autofocus/><br>
BBB:<input id="BBB" class='TabOnEnter' tabindex="2" /><br>
CCC:<input id="CCC" class='TabOnEnter' tabindex="3" /><br>
DDD:<input id="DDD" class='TabOnEnter' tabindex="4" /><br>
</body>
</html>
เครดิต: http://jsfiddle.net/konijn_gmail_com/WvHKA/
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title> Next Tab DEMO</title>
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<script type='text/javascript'>//<![CDATA[
$(window).load(function(){
$(document).on("keypress", ".TabOnEnter" , function(e)
{
//Only do something when the user presses enter
if( e.keyCode == 13 )
{
var nextElement = $('input[tabindex="' + (this.tabIndex+1) + '"]');
if(nextElement.length )
nextElement.focus();
else
$('input[tabindex="1"]').focus();
}
});
});//]]>
</script>
</head>
<body>
AAA:<input id="AAA" class='TabOnEnter' tabindex="1" autofocus/><br>
BBB:<input id="BBB" class='TabOnEnter' tabindex="2" /><br>
CCC:<input id="CCC" class='TabOnEnter' tabindex="3" /><br>
DDD:<input id="DDD" class='TabOnEnter' tabindex="4" /><br>
</body>
</html>
เครดิต: http://jsfiddle.net/konijn_gmail_com/WvHKA/
วิธี Setfocus ให้ textbox เหมือนกับ google เมื่อเปิด url (HTML)
สังเกตุใหมครับว่าเมื่อเราเปิด google ขึ้นมา cursor จะมาพร้อมอยู่ที่ textbox เพื่อให้เราพิมพ์ได้เลย วิธีทำดังนี้ครับ
<input type="text" name="search" autofocus>
ส่วนวิธีกำหนด Tabindex ดังนี้ครับ
FirstName: <input name="firstname" tabindex="1" autofocus>
Lastname: <input name="lastname" tabindex="2" >
tel: <input name="tel" tabindex="3"
<input type="text" name="search" autofocus>
ส่วนวิธีกำหนด Tabindex ดังนี้ครับ
FirstName: <input name="firstname" tabindex="1" autofocus>
Lastname: <input name="lastname" tabindex="2" >
tel: <input name="tel" tabindex="3"
สมัครสมาชิก:
บทความ (Atom)
