 |
|
C# winApp เราสารมารถนำเอา code javascript มาใช้ใน winapp ได้ไม๊ อย่างไรครับ |
|
 |
|
|
 |
 |
|
ทำได้ครับ   
|
 |
 |
 |
 |
Date :
2016-06-30 16:44:24 |
By :
taotechnocom |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ตอบความคิดเห็นที่ : 1 เขียนโดย : taotechnocom เมื่อวันที่ 2016-06-30 16:44:24
รายละเอียดของการตอบ ::
ทำยังไงรึท่าน
นี่โค้ด js ครับ
Code (JavaScript)
var ab=[["Celsius [°C]",'vv + 273.15','vv - 273.15'],["Fahrenheit [°F]",'5/9 * (vv + 459.67)','9/5 * vv - 459.67'],["Kelvin [K]",1],["Rankine [°R]",'5/9 * vv','9/5 * vv'],["Reaumure [°r]",'5/4 * vv + 273.15','4/5 * (vv - 273.15)']];
var bb;
function jo(db)
{
var eb = window.onload;
window.onload = (typeof window.onload != "function") ? db : function () { eb(); db(); };
}
function ko(db)
{
var gb = window.onunload;
window.onload = (typeof window.onload != "function") ? db : function () { gb(); db(); };
}
jo(lo);
ko(mo);
function no(kb, value, lb)
{
var mb = new Date();
mb.setDate(mb.getDate() + lb);
document.cookie = kb + "=" + escape(value) + ((lb == null) ? "" : ";expires=" + mb.toGMTString());
}
function oo(kb)
{
if (document.cookie.length > 0)
{
ob = document.cookie.indexOf(kb + "=");
if (ob != -1)
{
ob = ob + kb.length + 1;
pb = document.cookie.indexOf(";", ob);
if (pb == -1) pb = document.cookie.length;
return unescape(document.cookie.substring(ob, pb));
}
}
return "";
}
function lo()
{
po();
if (document.getElementById('valuetotemperature1'))
{
qo(); cc_temperature1();
}
}
function po(){bb=ro();}
function qo()
{
var tb = so("selectfromtemperature1", 0);
var vb = so("selecttotemperature1", 0);
to('selectfromtemperature1', tb);
to('selecttotemperature1', vb);
document.getElementById('valuefromtemperature1').value = so("valuefromtemperature1", 1);
}
function mo()
{
if (document.getElementById('valuetotemperature1'))
{
var xb; xb = document.getElementById('selectfromtemperature1');
no('selectfromtemperature1', xb.options[xb.selectedIndex].value, 365);
xb = document.getElementById('selecttotemperature1'); no('selecttotemperature1', xb.options[xb.selectedIndex].value, 365);
xb = document.getElementById('valuefromtemperature1'); no('valuefromtemperature1', xb.value, 365);
}
}
function to(yb, zb)
{
var xb = document.getElementById(yb);
if ((zb >= 0) && (zb < xb.options.length))
{
xb.selectedIndex = zb;
}
}
function uo(_b,X){X=(!X?6:X);return Math.round(_b*Math.pow(10,X))/Math.pow(10,X);}
function so(ac, bc)
{
var cc = oo(ac);
return (cc === false)?bc:cc;
}
function ro(){return parseInt(so("floatnumber",6));}
function vo(ec){var ValidChars="0123456789.";for(i=0;i<ec.length;i++){if(ValidChars.indexOf(ec.charAt(i))==-1){return false;}
}
return true;}
function ins_temperature1(fc)
{
document.writeln('<select name="' + fc + '" id="' + fc + '" size="1" onchange="cc_temperature1()">');
for (i = 0; i < ab.length; i++) { document.writeln('<option value="' + i + '">' + ab[i][0] + '</option>'); }
document.writeln('</select>');
}
function wo(hc, vv, ic)
{
var jc = ab[hc];
var kc = ab[ic];
vv = vo(jc[1]) ? vv * jc[1] : eval(jc[1]);
vv=vo(kc[1])?vv/kc[1]:eval(kc[2]);
return uo(vv, bb);
}
function cc_temperature1()
{
var lc = parseFloat(document.getElementById('valuefromtemperature1').value);
if (isNaN(lc))
{ document.getElementById('valuetotemperature1').value = ''; }
else
{
var tb = document.getElementById('selectfromtemperature1').selectedIndex;
var vb = document.getElementById('selecttotemperature1').selectedIndex;
document.getElementById('valuetotemperature1').value = wo(tb, lc, vb);
mc = document.getElementById('valueresulttemperature1').tagName;
if (mc == "SPAN")
document.getElementById('valueresulttemperature1').innerHTML = lc + " " + nc(document.getElementById('selectfromtemperature1').options[document.getElementById('selectfromtemperature1').selectedIndex].text) + " = " + document.getElementById('valuetotemperature1').value + " " + nc(document.getElementById('selecttotemperature1').options[document.getElementById('selecttotemperature1').selectedIndex].text);
else
document.getElementById('valueresulttemperature1').value = lc + " " + nc(document.getElementById('selectfromtemperature1').options[document.getElementById('selectfromtemperature1').selectedIndex].text) + " = " + document.getElementById('valuetotemperature1').value + " " + nc(document.getElementById('selecttotemperature1').options[document.getElementById('selecttotemperature1').selectedIndex].text);
}
}
function ccb_temperature1()
{
var lc = parseFloat(document.getElementById('valuetotemperature1').value);
if (isNaN(lc))
{ document.getElementById('valuefromtemperature1').value = ''; }
else
{
var tb = document.getElementById('selecttotemperature1').selectedIndex;
var vb = document.getElementById('selectfromtemperature1').selectedIndex;
document.getElementById('valuefromtemperature1').value = wo(tb, lc, vb);
document.getElementById('valueresulttemperature1').value = document.getElementById('valuefromtemperature1').value + " " + nc(document.getElementById('selectfromtemperature1').options[document.getElementById('selectfromtemperature1').selectedIndex].text) + " = " + lc + " " + nc(document.getElementById('selecttotemperature1').options[document.getElementById('selecttotemperature1').selectedIndex].text);
}
}
function nc(oc)
{
return oc; var pc;
if ((oc.indexOf('(') == -1) && (oc.indexOf('[') == -1)) pc = oc.split();
else {
var qc = oc.indexOf(' ');
if (qc == -1) qc = 999;
var rc = oc.indexOf('(');
if (rc == -1) rc = 999;
var sc = oc.indexOf('[');
if (sc == -1) sc = 999;
var tc = ' ';
if (rc < qc) {tc = '(';if (sc < rc) { tc = '['; }}else{tc=' ';if(sc<qc){tc='[';}
}
pc=oc.split(tc);}
return pc[0];}
|
 |
 |
 |
 |
Date :
2016-06-30 17:01:11 |
By :
lamaka.tor |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
มีเมลไหมครับ เดี๋ยวผมส่งโปรเจคไปให้ น่าจะดีกว่า
|
 |
 |
 |
 |
Date :
2016-06-30 17:08:54 |
By :
taotechnocom |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ข่าวร้ายครับ
nod แจ้งว่าเป็นไวรัส 5555 เลยโหลดไม่ได้ครับ
ถ้าจากโค้ดด้านบนผมจะเอา
function wo(hc, vv, ic)
มาใช้ต้องเรียกใช้ยังไงครับ
|
 |
 |
 |
 |
Date :
2016-06-30 17:49:52 |
By :
lamaka.tor |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
WIN
จาก #NO0 -@NO7
ถ้าผมไม่อนุญาติ ถ้ามีปัญญาก็แกะเอา
เผย 3ชั้น (ยังไม่รวมที่ซ่อนเอาไว้อีก 6 ชั้น + อื่นฯ)
(ของจริง)
WEB
Code (VB.NET)
'2011-03-24 Support Windows Client & All Application. example delphi, visual foxpro, etc
'Dim s As String = FormsAuthentication.GetRedirectUrl("userName", False)
'Result = "/default.aspx"
If Request.QueryString("UserName") <> Nothing AndAlso Request.QueryString("Password") <> Nothing Then
Dim strUserName As String = Request.QueryString("UserName") '***** byebye Decrypt
Dim strPassword As String = Request.QueryString("Password") '***** byebye Decrypt
' ******************************************************************************************
' Protect Decomplier Algorithm with C++ for Encrypt UserName and Password
' validation here and check the username and password in the database
' *******************************************************************************************
If FormsAuthentication.Authenticate(strUserName, strPassword) Then 'Check in web.config with SHA1/More
FormsAuthentication.SetAuthCookie(strUserName, False, FormsAuthentication.FormsCookiePath)
End If
FormsAuthentication.RedirectFromLoginPage(strUserName, False, FormsAuthentication.FormsCookiePath)
' Create cookie and return it
Dim ticket As New FormsAuthenticationTicket(1,
strUserName,
DateTime.Now,
DateTime.Now.AddDays(7),
False,
New Guid().ToString(),
FormsAuthentication.FormsCookiePath)
' Encrypt the ticket.
Dim encTicket As String = FormsAuthentication.Encrypt(ticket) '& "|" & strUserName
'Fixed bug Redirect (For Windows Application)
Response.RedirectPermanent("Default.aspx?EncryptCookieToWebClient=" & encTicket) 'Root
End If
อันนี้คือ web.config
Code (XML)
<!--<location path="SEX.aspx">
<system.web>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location>-->
<location path="..\..\YOURNEEDFOLDER">
<system.web>
<authorization>
<deny users="?"/>
<allow users="SEX"/>
</authorization>
</system.web>
</location>
|
 |
 |
 |
 |
Date :
2016-06-30 21:20:32 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ผมขอถามหน่อยว่า ผมจะส่งพารามิเตอร์ generic List(Of T) ให้กับ User Control มันต้องทำอย่างไร?

อันนี้ Source Code
Code (VB.NET)
Imports System.Drawing
Imports System.Windows.Forms
Imports System.ComponentModel
<ToolboxBitmap(GetType(TextBox))> _
Public Class usrCtrlTextBoxButton : Inherits TextBox
Private ReadOnly _button As Button 'ปุ่มค้นหา
Private Property _TextBox As TextBox 'แสดงผลลัพธ์จาการค้นหา (Memory/Database)
Private _lst As IList 'generic พารามิเตอร์
<Browsable(True), _
EditorBrowsable(EditorBrowsableState.Always), _
Description("The items with sub items that should be displayed"), _
DesignerSerializationVisibility(DesignerSerializationVisibility.Content)> _
<System.ComponentModel.DefaultValue(GetType(IList), ""), System.ComponentModel.Category("Appearance")> _
Public Property lst As IList 'IEnumerable(Of Object)() / Any Type
Get
Return _lst 'ไอ้ตรงนี้แหละ ยังทำไม่ได้
End Get
Set(value As IList)
_lst = value 'ไอ้ตรงนี้แหละ ยังทำไม่ได้
End Set
End Property
Public Sub New()
_button = New Button() With {.Cursor = Cursors.Hand, .TabStop = False}
AddHandler _button.SizeChanged, Sub(o, e)
OnResize(e)
End Sub
AddHandler _button.Click, AddressOf btn_Click
Me.Controls.Add(_button)
End Sub
Public Custom Event ButtonClick As EventHandler
AddHandler(value As EventHandler)
AddHandler _button.Click, value
End AddHandler
RemoveHandler(value As EventHandler)
RemoveHandler _button.Click, value
End RemoveHandler
RaiseEvent(sender As Object, e As EventArgs)
'TODO
End RaiseEvent
End Event
''' <summary>
''' Find Data in Memory/Database.
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub btn_Click(sender As Object, e As EventArgs)
MsgBox("Click in WL_Controls.usrCtrlTextBoxButton")
Me.Focus()
End Sub
''' <summary>
''' Display Description from Search.
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
<System.ComponentModel.DefaultValue(GetType(TextBox), "TextCharacter"), System.ComponentModel.Category("Appearance")> _
Public Property TextBox() As TextBox
Get
Return _TextBox
End Get
Set(ByVal value As TextBox)
_TextBox = value
End Set
End Property
Protected Overrides Sub OnResize(e As EventArgs)
MyBase.OnResize(e)
_button.Size = New Size(28, Me.ClientSize.Height + 2)
_button.Image = Global.WL_Controls.My.Resources.Resources.PersonWoman2
_button.Location = New Point(Me.ClientSize.Width - _button.Width - 1, -1)
' Send EM_SETMARGINS to prevent text from disappearing underneath the button
SendMessage(Me.Handle, &HD3, New System.IntPtr(2), New System.IntPtr(_button.Width << 16))
End Sub
<System.Runtime.InteropServices.DllImport("user32.dll")> _
Private Shared Function SendMessage(hWnd As IntPtr, msg As Integer, wp As IntPtr, lp As IntPtr) As IntPtr
End Function
''' <summary>
''' ค้นหาข้อมูลจาก Memory/Database
''' </summary>
''' <param name="e"></param>
''' <remarks></remarks>
Protected Overrides Sub OnTextChanged(e As EventArgs)
Dim found As Boolean = True
If 1 = 1 Then 'Search in Memory
Else 'Search in Database Select * From Where ก็ว่ากันไป
End If
If found Then
Me.TextBox.Text = Me.Text
Else
Me.TextBox.Text = String.Empty
End If
MyBase.OnTextChanged(e)
End Sub
Public Enum TextBoxDisplayManager As Byte
TextCharacter = 0
TextNumber = 1
TextInteger = 2
End Enum
Public Enum TextBoxDisplayPrecisionScale As Byte
None = 0
One = 1
Two = 2
Tree = 3
Four = 4
Five = 5
Six = 6
Seven = 7
Eight = 8
Nine = 9
Ten = 10
End Enum
Public Enum TextBoxDisplayOnEnterMoveNext As Byte
Yes
No
End Enum
Public Enum TextBoxDisplayIsEnabledBinding As Byte
Yes
No
End Enum
#Region " Variables "
Private _DisplayManager As TextBoxDisplayManager
Private _DisplayPrecisionScale As TextBoxDisplayPrecisionScale
Private _DisplayOnEnterMoveNext As TextBoxDisplayOnEnterMoveNext
Private _DisplayIsEnabledBinding As TextBoxDisplayIsEnabledBinding
#End Region
#Region " Properties "
<System.ComponentModel.DefaultValue(GetType(TextBoxDisplayManager), "TextCharacter"), System.ComponentModel.Category("Appearance")> _
Public Property DisplayManager() As TextBoxDisplayManager
Get
Return _DisplayManager
End Get
Set(ByVal value As TextBoxDisplayManager)
_DisplayManager = value
If Me._DisplayManager = TextBoxDisplayManager.TextNumber Then
MyBase.TextAlign = HorizontalAlignment.Right
End If
End Set
End Property
<System.ComponentModel.DefaultValue(GetType(TextBoxDisplayPrecisionScale), "None"), System.ComponentModel.Category("Appearance")> _
Public Property DisplayPrecisionScale() As TextBoxDisplayPrecisionScale
Get
Return _DisplayPrecisionScale
End Get
Set(ByVal Value As TextBoxDisplayPrecisionScale)
_DisplayPrecisionScale = Value
If Me._DisplayManager = TextBoxDisplayManager.TextNumber Then
MyBase.TextAlign = HorizontalAlignment.Right
Dim dblSubMybaseText As Double
If String.IsNullOrEmpty(MyBase.Text) OrElse Not IsNumeric(MyBase.Text) Then
dblSubMybaseText = 0
Else
dblSubMybaseText = CDbl(MyBase.Text)
End If
FormatText(dblSubMybaseText)
ElseIf Me.DisplayManager = TextBoxDisplayManager.TextInteger Then
MyBase.Text = "0"
Else
MyBase.Text = String.Empty
End If
End Set
End Property
<System.ComponentModel.DefaultValue(GetType(TextBoxDisplayOnEnterMoveNext), "Yes"), System.ComponentModel.Category("Appearance")> _
Public Property DisplayOnEnterMoveNext() As TextBoxDisplayOnEnterMoveNext
Get
Return _DisplayOnEnterMoveNext
End Get
Set(ByVal value As TextBoxDisplayOnEnterMoveNext)
_DisplayOnEnterMoveNext = value
End Set
End Property
<System.ComponentModel.DefaultValue(GetType(TextBoxDisplayIsEnabledBinding), "Yes"), System.ComponentModel.Category("Appearance")> _
Public Property DisplayIsEnabledBinding() As TextBoxDisplayIsEnabledBinding
Get
Return _DisplayIsEnabledBinding
End Get
Set(ByVal value As TextBoxDisplayIsEnabledBinding)
_DisplayIsEnabledBinding = value
End Set
End Property
#End Region
'Protected Overrides Sub OnBindingContextChanged(ByVal e As System.EventArgs)
' MyBase.OnBindingContextChanged(e)
'End Sub
Protected Overrides Sub OnKeyPress(ByVal e As System.Windows.Forms.KeyPressEventArgs)
If Me._DisplayManager = TextBoxDisplayManager.TextNumber Then
If e.KeyChar < "0" Or e.KeyChar > "9" Then
If AscW(e.KeyChar) = Keys.Back Then
e.Handled = False
Else
If e.KeyChar = "." And MyBase.Text.Contains(".") = False Then
e.Handled = False
ElseIf e.KeyChar = "-" And MyBase.Text.Contains("-") = False Then
e.Handled = False
Else
e.Handled = True
End If
End If
End If
ElseIf Me._DisplayManager = TextBoxDisplayManager.TextInteger Then
If e.KeyChar < "0" Or e.KeyChar > "9" Then
If AscW(e.KeyChar) = Keys.Back Then 'Backspace
e.Handled = False
Else
e.Handled = True
End If
End If
End If
If AscW(e.KeyChar) = Keys.Enter AndAlso _DisplayOnEnterMoveNext = TextBoxDisplayOnEnterMoveNext.Yes Then
SendKeys.Send("{TAB}")
End If
End Sub
Protected Overrides Sub OnEnter(ByVal e As System.EventArgs)
MyBase.SelectionStart = 0
MyBase.SelectionLength = MyBase.Text.Length
End Sub
Protected Overrides Sub OnValidating(ByVal e As System.ComponentModel.CancelEventArgs)
If Me._DisplayManager = TextBoxDisplayManager.TextNumber Then
Dim dblSubMybaseText As Double
If String.IsNullOrEmpty(MyBase.Text) OrElse Not IsNumeric(MyBase.Text) Then
dblSubMybaseText = 0
Else
dblSubMybaseText = CDbl(MyBase.Text)
End If
FormatText(dblSubMybaseText)
End If
End Sub
Public Sub ResetValue()
If Me._DisplayManager = TextBoxDisplayManager.TextNumber Then
FormatText(0)
ElseIf Me.DisplayManager = TextBoxDisplayManager.TextInteger Then
MyBase.Text = "0"
Else
MyBase.Text = String.Empty 'Character
End If
End Sub
Private Sub FormatText(ByVal dblSubMybaseText As Double)
Select Case Me._DisplayPrecisionScale
Case TextBoxDisplayPrecisionScale.None
MyBase.Text = String.Format("{0:N0}", dblSubMybaseText)
Case TextBoxDisplayPrecisionScale.One
MyBase.Text = String.Format("{0:N1}", dblSubMybaseText)
Case TextBoxDisplayPrecisionScale.Two
MyBase.Text = String.Format("{0:N2}", dblSubMybaseText)
Case TextBoxDisplayPrecisionScale.Tree
MyBase.Text = String.Format("{0:N3}", dblSubMybaseText)
Case TextBoxDisplayPrecisionScale.Four
MyBase.Text = String.Format("{0:N4}", dblSubMybaseText)
Case TextBoxDisplayPrecisionScale.Five
MyBase.Text = String.Format("{0:N5}", dblSubMybaseText)
Case TextBoxDisplayPrecisionScale.Six
MyBase.Text = String.Format("{0:N6}", dblSubMybaseText)
Case TextBoxDisplayPrecisionScale.Seven
MyBase.Text = String.Format("{0:N7}", dblSubMybaseText)
Case TextBoxDisplayPrecisionScale.Eight
MyBase.Text = String.Format("{0:N8}", dblSubMybaseText)
Case TextBoxDisplayPrecisionScale.Nine
MyBase.Text = String.Format("{0:N9}", dblSubMybaseText)
Case TextBoxDisplayPrecisionScale.Ten
MyBase.Text = String.Format("{0:N10}", dblSubMybaseText)
Case Else
MyBase.Text = String.Format("{0:N0}", dblSubMybaseText)
End Select
End Sub
'ปิดเสียง ปี๊ด เมื่อกดปุ่ม Enter
'Private Sub SetBeepOff(ByVal senser As Control, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
' If e.KeyCode = Keys.Enter Then
' e.SuppressKeyPress = True
' SendKeys.Send("{Tab}")
' End If
'End Sub
'Protected Overrides Sub OnBindingContextChanged(ByVal e As System.EventArgs)
' MyBase.OnBindingContextChanged(e)
'End Sub
End Class
|
 |
 |
 |
 |
Date :
2016-07-01 08:00:45 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
จาก #NO9 Source code
บรรทัดที่ 19, 22 ผมยังทำไม่ได้
ถ้าได้ผมจะเอาไปใช้งานในบรรทัดที่ 53 และ 92
ขอบคุณล่วงหน้า
ปล. ผมจำเป็นต้องทำอย่างนี้ (แนวโน้มโปรแกรมของผมมีแต่จะขยายขนาดใหญ่ขึ้นฯฯฯ)
|
 |
 |
 |
 |
Date :
2016-07-01 08:12:42 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
@เจ้าของกระทู้และผู้ร่วมตอบ จาก #NO1 - #NO7
ความต้องการของคุณ มันเบนมาแนวทางของผมซึ่งผ่านการทดสอบแล้วตั้งแต่ปี 2013 ผมใช้ SignalR
Code (VB.NET)
'How To Install SignalR Client
'PM> Install-Package SignalR.Client -Version 0.6.0
'Install-Package Microsoft.AspNet.SignalR.Client -pre
'2013-05-14
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.IO
Imports System.Net
Imports System.Text
Imports System.Threading.Tasks
Imports Microsoft.AspNet.SignalR.Client
Imports Microsoft.AspNet.SignalR.Client.Hubs
Imports System.DirectoryServices
Imports System.DirectoryServices.AccountManagement
Public Class frmMain : Inherits Form
Private Delegate Sub SetTextCallback(text As String)
Private _connectionPersistent As Connection 'PersistentConnection
'Private _connectionHub As HubConnection() 'HubConnection
Private _ChatData As New ChatData()
Shared ConnectedUsers As New List(Of UserDetail)()
Shared CurrentMessage As New List(Of MessageDetail)() 'Class/MessageDetail.vb
Dim Fmt As New StringFormat() With {.LineAlignment = StringAlignment.Center}
Public Sub New()
InitializeComponent()
'ระวัง Version Client และ Server ทุกฯตัว
'ระวังติด <authentication mode="Forms">
'ระวังติด <authorization>
'Domain : www.goodluck.smpksme.com (จะต้องไม่มี http:// นำหน้า)
'SignalR Website : http://www.xxx.yyy.com/echo
'Authenticate Website : http://www.xxx.yyy.com/CreateASPXAUTHCookie.aspx
'
End Sub
Protected Overrides Sub OnPaint(e As System.Windows.Forms.PaintEventArgs)
Dim ss As New Bitmap(txtDomain.Width, txtDomain.Height)
txtDomain.DrawToBitmap(ss, New Rectangle(0, 0, txtDomain.Width, txtDomain.Height))
MyBase.OnPaint(e)
End Sub
Private Sub frmMain_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
'TextBox1.Text = "_connection between Head Office and branch, Branch to Branch."
End Sub
Private Sub frmMain_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.Enter Then
btnSend.PerformClick()
End If
End Sub
#Region "ConnectToSignalR"
Private Sub UrlSet_Click(sender As System.Object, e As System.EventArgs) Handles UrlSet.Click
txtDomain.Text = "www.xxx.yyy.com"
txtSignalWebsite.Text = "http://www.xxx.yyy.com/echo"
'txtAuthWebsite.Text = "http://www.xxx.yyy.com/CreateASPXAUTHCookie.aspx"
txtAuthWebsite.Text = "http://www.xxx.yyy.com/LoginG.aspx"
'~
'Real Setup
'Domain : www.xxx.yyy.com (จะต้องไม่มี http:// นำหน้า)
'SignalR Website : http://www.xxx.yyy.com/echo
'Authenticate Website : http://www.xxx.yyy.com/CreateASPXAUTHCookie.aspx
'2013-16-10 Change to
'Authenticate Website : http://www.xxx.yyy.com/LoginG.aspx
'Web.config
'<authorization>
' <deny users="?" />
'</authorization>
'deny = * means deny everyone
'deny = ? means deny unauthenticated users
'allow users="dan,matthew"
End Sub
'ระวัง
'Auten
'Error : Too many automatic redirections were attempted.
Private Sub btnConnect_Click(sender As Object, e As EventArgs) Handles btnConnect.Click
Me.Cursor = Cursors.WaitCursor
Try
Call ConnectToSignalR()
btnSend.Enabled = True
btnDisconnect.Enabled = True
btnConnect.Enabled = False
PictureBox1.Image = Global.WL_SignalRClient.My.Resources.Resources.cn01
Catch ex As Exception
PictureBox1.Image = Global.WL_SignalRClient.My.Resources.Resources.cn02
MsgBox("Error : " & ex.Message) 'MessageBox.Show(ex.InnerException.Message)
End Try
Me.Cursor = Cursors.Default
End Sub
Private Sub ConnectToSignalR(Optional ByVal intExpired As Integer = 480)
Dim varDomainName As String = If(txtDomain.Text.StartsWith("http://", StringComparison.CurrentCultureIgnoreCase), txtDomain.Text.Substring(7), txtDomain.Text)
' Connect to the Server service
_connectionPersistent = New Connection(txtSignalWebsite.Text) 'Microsoft.AspNet.SignalR.Client
' Fire _connection_Received when message comes in
AddHandler _connectionPersistent.Received, AddressOf _connection_Received
' Create a Cookie
Dim objCookie As New Cookie()
' Set the values
objCookie.Domain = varDomainName 'If(txtDomain.Text.StartsWith("http://", StringComparison.CurrentCultureIgnoreCase), txtDomain.Text.Substring(7), txtDomain.Text)
objCookie.Expires = DateTime.Now.AddMinutes(intExpired) ' 8 ชั่วโมงการทำงาน
'objCookie.HttpOnly = False 'Default False
objCookie.Name = "ASPXAUTH"
'สำคัญเหมือนกัน
'objCookie.Path = "~/"
objCookie.Path = "/"
objCookie.Secure = False
objCookie.Value = GetCookie()
' The Forms Auth Ticket. Create a Cookie container and put the Cookie inside
_connectionPersistent.CookieContainer = New CookieContainer()
_connectionPersistent.CookieContainer.Add(objCookie)
' Start the _connection
'_connection.GroupsToken = txtGroupName.Text 'ใส่ตัวนี้แล้ว Windows Client รับ Message ไม่ได้งงฉิบหาย
'_connectionPersistent.GroupsToken
'_connectionPersistent.Credentials = CredentialCache.DefaultCredentials
_connectionPersistent.Start().Wait()
Try
If _connectionPersistent.ConnectionId IsNot Nothing Then
'Send UserName And GroupName
Call SendData(txtGroupName.Text, txtUserName.Text, String.Empty, "NewUser", "S", String.Empty) 'Fixed SignalR send the group name on connected.
If ConnectedUsers.Find(Function(x) x.ConnectionId = _connectionPersistent.ConnectionId) Is Nothing Then
ConnectedUsers.Add(New UserDetail() With {.ConnectionId = _connectionPersistent.ConnectionId, .UserName = txtUserName.Text, .GroupName = txtGroupName.Text})
End If
End If
Catch ex As Exception
'TODO
End Try
End Sub
'More...
'More...
'More...
End Class
ปล. C++ ผมเขียนไม่เป็นหรอก ผมโม้ไปอย่างนั้นแหละ (ผมให้น้องเขาเขียนให้)
|
 |
 |
 |
 |
Date :
2016-07-01 08:33:27 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
สัญชาติญาณของโปรแกรมเมอร์
--- อะไรเกินก็เอาออก อะไรขาดก็เพิ่มเติมเอา
แบบนี้มันดูขัดลูกหูลูกตา
Code (VB.NET)
Private Sub FormatText(ByVal dblSubMybaseText As Double)
Select Case Me._DisplayPrecisionScale
Case TextBoxDisplayPrecisionScale.None
MyBase.Text = String.Format("{0:N0}", dblSubMybaseText)
Case TextBoxDisplayPrecisionScale.One
MyBase.Text = String.Format("{0:N1}", dblSubMybaseText)
Case TextBoxDisplayPrecisionScale.Two
MyBase.Text = String.Format("{0:N2}", dblSubMybaseText)
Case TextBoxDisplayPrecisionScale.Tree
MyBase.Text = String.Format("{0:N3}", dblSubMybaseText)
Case TextBoxDisplayPrecisionScale.Four
MyBase.Text = String.Format("{0:N4}", dblSubMybaseText)
Case TextBoxDisplayPrecisionScale.Five
MyBase.Text = String.Format("{0:N5}", dblSubMybaseText)
Case TextBoxDisplayPrecisionScale.Six
MyBase.Text = String.Format("{0:N6}", dblSubMybaseText)
Case TextBoxDisplayPrecisionScale.Seven
MyBase.Text = String.Format("{0:N7}", dblSubMybaseText)
Case TextBoxDisplayPrecisionScale.Eight
MyBase.Text = String.Format("{0:N8}", dblSubMybaseText)
Case TextBoxDisplayPrecisionScale.Nine
MyBase.Text = String.Format("{0:N9}", dblSubMybaseText)
Case TextBoxDisplayPrecisionScale.Ten
MyBase.Text = String.Format("{0:N10}", dblSubMybaseText)
Case Else
MyBase.Text = String.Format("{0:N0}", dblSubMybaseText)
End Select
End Sub
มันต้องเป็นแบบนี้
Code (VB.NET)
Private Sub FormatText(ByVal dblSubMybaseText As Double)
MyBase.Text = String.Format("{0:N" & Me._DisplayPrecisionScale & "}", dblSubMybaseText)
End Sub
|
 |
 |
 |
 |
Date :
2016-07-01 09:01:04 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
จาก #NO12 - #NO13
ผมมีเหตุผลกำกับเสมอ แล้วสักวันหนึ่งคุณจะรู้ด้วยตัวของคุณเองครับ

|
 |
 |
 |
 |
Date :
2016-07-01 09:07:58 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ราคาโปรแกรมของผมไม่ใช่หลักหมื่นแต่ไม่ถึงหลักล้าน บาท
--- บ่ายนี้ผมต้องไปคุยงาน (Stock & General Ledger)
------ ได้งานก็ดีไม่ได้ผมก็เฉยฯ (ผมมีอะไรที่ต้องทำอีกเยอะแยะ)
เล่าความเป็นมาของโปรแกรมนี้ให้ฟังแบบคร่าวฯ
มี ผ.อ. โรงเรียนแห่งหนึ่ง + น้องสาวทำงานบริษัทเอกชน (เงินเดือนสองแสนกว่าบาท)
--- เล่าให้ฟังว่า มีหลานสาว (นิสัยดี) แต่ไม่ฉลาดตั้งแต่กำเนิด เรียนจบแค่ ม.3 (มีลูกตอนแก่) และสองคนนี้รักหลานสาวคนนี้มากฯ
--- เป็นห่วงอนาคตของเขา ก็เลยคิดเปิดร้านขายอุปกรณ์การเกษตรให้หลานดูแล
--- สิ่งที่ต้องการจริงฯ ก็คือ ยิงบาร์โค๊ด คิดเงิน ให้ถูกต้องก็เพียงพอ
รบกวนออกแบบโปรแกรมให้ผมหน่อย (เขาและผมไม่ได้คุยกันถึงราคาของโปรแกรม นี่คือความสัตย์จริง)
ผม: ได้ครับ
Screen Design ผมทำแบบหยาบฯ แต่ข้อสังเกตุมันดูดีกว่าคนบางคนที่ตั้งใจทำเสียอีก
--- รูปภาพสินค้ายังไม่มี (ด้านหน้า-หลัง-ข้าง-อื่นฯ เพิ่มเติมภายหลังได้)
จากรูปภาพแทนมากกว่าหนึ่งคำ
--- การค้นหาข้อมูลพื้นฐาน ทำได้หลากหลายช่องทาง
----- ป้อนรหัสให้ถูกต้อง เพื่อแสดงรายละเอียดนั้นฯ
----- คลิกปุ่มค้นหา เพื่อแสดงรายละเอียดนั้นฯ
อะไรที่ซ้ำฯ ผมจะไม่เขียน Source Code เป็นครั้งที่ 2

|
 |
 |
 |
 |
Date :
2016-07-01 11:15:37 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
จาก #NO18
Source Code ที่ไร้คุณภาพ จะไม่ปรากฏ (มี) อยู่ในโปรแกรมตัวนี้แน่นอน ครับ
|
 |
 |
 |
 |
Date :
2016-07-01 11:28:47 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ตอบความคิดเห็นที่ : 18 เขียนโดย : หน้าฮี เมื่อวันที่ 2016-07-01 11:15:37
รายละเอียดของการตอบ ::
เอ... แต่ผมเห็นแบบนี้เมื่อ หลาย ปีมาแล้ว ผมแก้งาน paywin ให้ ฝ่ายบุคคลอยู่
ผมชอบรูปแบบค้นหาแบบนี้มากเพราะมันช่วยให้มุมมอง user กว้างขึ้น
นอกจากนั้นโปรแกรมนั้นยังมี SQL ex ซ่อนในการค้นหาขึ้นสูงอีกด้วยครับ
ตอนนั้นผมยังไม่หัดเขียนโปรแกรม เลย ไม่รู้ว่ามีไว้ทำไม
ทุกวันนี้ผมใช้ SQL ex สำหรับค้นหารายชื่อลูกค้าขั้นสูงอยู่ครับ
ทำบ้านๆแบบนี้แหละครับ แต่ เพิ่มให้พิม SQL ในการค้นหาได้
เผื่อสำหรับ User ที่พอใช้งาน SQL เป็น ก็สามารถสร้างเงื่อนไงในหน้าค้นหานี้ได้ด้วย(แต่ก็ไม่เห็นมีใครใช้กัน อุตส่านั่งเขียนทั้งวัน 5555)
บางครั้งการค้นหาอาจจะซับซ้อน
ยกตัวอย่าง รายชื่อติดต่อ(ผมจะไม่ใช้คำว่า รายชื่อลูกค้า เพราะ Cus อาจจะกลายเป็น Sub เมื่อไหร่ก็ได้)
แบบแยกประเภท เช่น รายชื่อติดต่อ ประเภท Auditor
หรือ รายชื่อ สินค้า ชื่อหนึ่ง ใน lot หนึ่ง ซึ่งเก็บแยกไว้ใน โกดังหนัง ที่อยู่ในพื้นที่หนึ่ง ในจังหวัดหนึ่ง ในประเทศหนึ่ง
ประมาณนั้นครับ สรุปไม่มีใครใช้ซักคน 5555
|
 |
 |
 |
 |
Date :
2016-07-01 11:45:35 |
By :
lamaka.tor |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
จาก #NO9 OK PASS
เปลี่ยนจาก
Code (VB.NET)
Private _lst As IList 'generic พารามิเตอร์
เป็น
Code (VB.NET)
Private Shared_lst As IList 'generic พารามิเตอร์
ผ่านฉลุย
วิธีการใช้งาน (เผื่อ Programmer บางคนที่อาจจะไม่ฉลาดตั้งแต่กำเนิด)
Code (VB.NET)
lstARType = TRANTab.GetList("", "A") 'ข้อมูลลูกหนี้(ลูกค้า)
UsrCtrlTextBoxButton1.lst = lstARType.Cast(Of Object)() 'Any Type
|
 |
 |
 |
 |
Date :
2016-07-01 11:47:50 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
หลังจากนั่งแกะมาครึ่งวัน
เจอปัญหานี้ครับ

Code (JavaScript)
function vo(ec)
{
var ValidChars="0123456789.";
for(i=0;i<ec.length;i++)
{
if(ValidChars.indexOf(ec.charAt(i))==-1)
{
return false;
}
}
return true;
}
function wo(hc, vv, ic)
{
alert(vv);
var jc = ab[hc];
var kc = ab[ic];
vv = vo(jc[1]) ? vv * jc[1] : eval(jc[1]);
alert(vv + "_" +jc[1]+"_"+ eval(jc[1]));
vv=vo(kc[1])?vv/kc[1]:eval(kc[2]);
return uo(vv, bb);
}
ตัว function vo ก็ return false
แต่พอ alert(vv + "_" +jc[1]+"_"+ eval(jc[1]));
ไง๋ vv ไม่เท่ากับ eval(jc[1]) ละครับ
|
 |
 |
 |
 |
Date :
2016-07-01 15:35:47 |
By :
lamaka.tor |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
และแล้วก็ถึงบางอ้อ
บันทักที่ผม alert มันเป็นการ eval(jc[1]) ไปเรียบร้อยแล้วจึงทำให้ค่าที่ผมได้ผิจากค่าที่ เขาคำนวนครับ
พอทำแบบนี้ถึงจะเข้าใจ
Code (C#)
function wo(hc, vv, ic)
{
var jc = ab[hc];
var kc = ab[ic];
//alert(vv);
alert(vv + "_" +jc[1]+"_"+ eval(jc[1]) + "&" + "_" +kc[2]+"_"+ eval(kc[2]));
vv = vo(jc[1]) ? vv * jc[1] : eval(jc[1]);
alert("eval(jc[1]) = " + eval(jc[1]));
vv=vo(kc[1])?vv/kc[1]:eval(kc[2]);
alert("eval(kc[2]) = "+eval(kc[2]))
return uo(vv, bb);
}
vv = 25
jc[1] = vv + 273.15
eval(jc[1]) = 25+273.15=298.15
kc[2] = 9/5 * vv - 459.67
eval(kc[2]) = 9/5 * 298.15 - 459.67 = 77 ^__^ ตรงคำนวนผิดไปรอบหนึ่ง
298.15 - 459.67 = -161.52
9/5 * (-161.52)=-290.736 #___#
ที่คิดได้ไม่ตรงกันเพราะผมดันเอา ค่าจาก alert(vv + "_" +jc[1]+"_"+ eval(jc[1])); ซึ่งผิดหลัก
ทำให้คิดค่า eval(kc[2]) เพี้ยนไปใหญ่อีก 5555
|
 |
 |
 |
 |
Date :
2016-07-02 09:24:18 |
By :
lamaka.tor |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
จาก
Code (JavaScript)
return uo(vv, bb);
Code (JavaScript)
var bb;
function po(){bb=ro();}
function ro(){return parseInt(so("floatnumber",6));}
function so(ac, bc)
{
var cc = oo(ac);
return (cc === false)?bc:cc;
}
function oo(kb)
{
if (document.cookie.length > 0)
{
ob = document.cookie.indexOf(kb + "=");
if (ob != -1)
{
ob = ob + kb.length + 1;
pb = document.cookie.indexOf(";", ob);
if (pb == -1) pb = document.cookie.length;
return unescape(document.cookie.substring(ob, pb));
}
}
return "";
}
function uo(_b,X){X=(!X?6:X);return Math.round(_b*Math.pow(10,X))/Math.pow(10,X);}
จากโค้ด สรุป X=bb ซึ่งก็น่าจะเท่ากับ 6 ใช่ไม๊ครับ
|
 |
 |
 |
 |
Date :
2016-07-02 09:37:24 |
By :
lamaka.tor |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
@lamaka.tor
มันคนละชั้นกัน (ถ้าคุณจะโกรธ มันก็สมควรแล้ว)
ถ้าผมบอกว่าสิ่งที่คุณกำลังทำ + ผมเพิ่มให้อีก 20 ปี + อนาคต + อายุของคุณ (และเงินเดือนของคุณ)
อย่าลืมประโยคนี้"
ผมกำลังจะบอกคุณว่า "ทำให้ตายเต็มที่ก็ได้แค่คำชมว่า ขยัน"
ปล. ชีวิตของผมผ่านร้อนผ่านหนาวไม่น้อยกว่าใครฯ
|
 |
 |
 |
 |
Date :
2016-07-02 21:18:36 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (JavaScript)
จากโค้ด สรุป X=bb ซึ่งก็น่าจะเท่ากับ 6 ใช่ไม๊ครับ
ผมเดาออกหมดว่าคุณต้องการอะไร?
--- 1. ผมไม่เคยโกหกกับคนที่ผมไม่เคยรู้จัก และในทำนองเดียววัน
--- 2. ผมมักจะใช้คำว่า "ไม่เคยโกหก" เพื่อทำให้คำว่า "โกหก" ดูหน้าเชื่อถื่อ"ยิ่งขึ้น"
คุณอยากให้ผมถามกลับไหมว่า JavaScript คืออะไร?
--- Code (JavaScript)
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>One Two Three Four File</title>
<!-- jQuery 2.1.4 -->
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.js"></script>
<script type="text/javascript">
//Check if jQuery was initialized and if not (CDN was down for example),
//then load jQuery from a local source.
//http://www.hanselman.com/blog/CDNsFailButYourScriptsDontHaveToFallbackFromCDNToLocalJQuery.aspx
if (typeof jQuery === 'undefined') {
document.write(unescape("%3Cscript src='./Scripts/jquery-2.1.4.min.js' type='text/javascript'%3E%3C/script%3E"));
}
</script>
</head>
<body>
<form id="frmTest">
<div id="msg">
</div>
<input id="btnTest1" type="button" value="WOW" />
</form>
<script type="text/javascript">
var person = {
firstName: "หลั่งไหลใน",
lastName: "หลั่งไหลนอก",
//keyword this Private Scope
showFullName: function () {
alert(this.firstName + " " + this.lastName + " showFullName local");
}
}
person.showFullName(); // ผลลัพธ์ มานะ พยายาม
//...
//...
//..
//More...
|
 |
 |
 |
 |
Date :
2016-07-02 21:26:49 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
"ทำให้ตายเต็มที่ก็ได้แค่คำชมว่า [ขยัน]"
|
 |
 |
 |
 |
Date :
2016-07-02 21:34:00 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
@Chaidhanan, @lamaka.tor, @...
พวกคุณพอมีโครงสร้างตารางของโปรแกรมระบบบัญชี Express for windows (version 1.5+)
--- ถ้ามี(พอหาได้) ผมขอหน่อยขอบคุณครับ
ตัวอย่างสิ่งที่ผมต้องการ

|
 |
 |
 |
 |
Date :
2016-07-04 10:40:52 |
By :
หน้าฮี |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|