Skip to content

Instantly share code, notes, and snippets.

View Hedgehogs1974's full-sized avatar

Hedgehogs1974

View GitHub Profile
Select Case e.KeyCode
Case Keys.Tab
e.IsInputKey = True
End Select
Dim Year As String = Text.ToString.Substring(0, 2)
Dim Month As String = Text.ToString.Substring(2, 2)
Dim Day As String = Text.ToString.Substring(4, 2)
Try
'日付型に変換して有効な値が設定されているか確認する
Dim tmp As String = String.Format("20{0}/{1}/{2}", Year, Month, Day)
DateTime.Parse(tmp)
Catch
MessageBox.Show("有効な日付を設定してください")
'文字列の場合
txtTokuisakiCode.Text = form.code.PadLeft(4, "0"c)
'数値の場合
txtTokuisakiCode.Text = String.Format("{0:0000}", form.code)
Dim i As Integer = 0
For Each row In dsDetail.Tables(0).Rows
Dim form As New DetailForm With {
.TopLevel = False,
.Size = New Size(1048, 58),
.Location = New Point(0, i * 57)
}
pnlDetail.Controls.Add(form)
form.Show()
form.BringToFront()
Dim column As New DataGridViewButtonColumn With {
.UseColumnTextForButtonValue = True
}
dgvMasterList.Columns.Add(column)
dgvMasterList.DataSource = dtTarget
For Each row As DataGridViewRow In dgvMasterList.Rows
Dim strBtn As String = String.Format("{0}-{1}", row.Cells(1).Value, row.Cells(2).Value)
Dim newcell As New DataGridViewButtonCell() With {
.Value = strBtn