29/10/15 18:30
nessuno
Che "codice" si può postare per un progetto simile?
Dovresti, prima di tutto, progettare un DB per memorizzare i dati ...
Dovresti, prima di tutto, progettare un DB per memorizzare i dati ...
Ricorda che nessuno è obbligato a risponderti e che nessuno è perfetto ...
---
Il grande studioso italiano Bruno de Finetti ( uno dei padri fondatori del moderno Calcolo delle probabilità ) chiamava il gioco del Lotto Tassa sulla stupidità.
---
Il grande studioso italiano Bruno de Finetti ( uno dei padri fondatori del moderno Calcolo delle probabilità ) chiamava il gioco del Lotto Tassa sulla stupidità.
29/10/15 18:51
antoniobar
si quello lo so fare ma come faccio a creare datagridview stile calendario??
aaa
29/10/15 23:28
Ultimo
Postato originariamente da antoniobar:
salve, ho fatto alcuni programmi con vb.net ma sono sempre un principiante!!! vorrei creare per il mio lavoro un programma per le presenze mensili !! la mia intenzione è quella di popolare una datagridview con il mese corrente ma non so come fare o addirittura un calendario!! grazie se mi postate un codice o mi dite come arrivarci
grazie
salve, ho fatto alcuni programmi con vb.net ma sono sempre un principiante!!! vorrei creare per il mio lavoro un programma per le presenze mensili !! la mia intenzione è quella di popolare una datagridview con il mese corrente ma non so come fare o addirittura un calendario!! grazie se mi postate un codice o mi dite come arrivarci
grazie
forum.masterdrive.it/visual-basic-net-18/vb2010-calendario-cella-datagridview-68400/
If ok Then GOTO Avanza else GOTO Inizia
03/11/15 14:20
antoniobar
ho visto il codice ma la classe come faccio a farla avviare con il form?
lo so ma sono ad un livello bassisimo!!!
lo so ma sono ad un livello bassisimo!!!
aaa
03/11/15 16:06
Ultimo
Postato originariamente da antoniobar:
ho visto il codice ma la classe come faccio a farla avviare con il form?
lo so ma sono ad un livello bassisimo!!!
ho visto il codice ma la classe come faccio a farla avviare con il form?
lo so ma sono ad un livello bassisimo!!!
Imports System Imports System.Windows.Forms Public Class Form1 Public Class CalendarColumn Inherits DataGridViewColumn Public Sub New() MyBase.New(New CalendarCell()) End Sub Public Overrides Property CellTemplate() As DataGridViewCell Get Return MyBase.CellTemplate End Get Set(ByVal value As DataGridViewCell) ' Ensure that the cell used for the template is a CalendarCell. If (value IsNot Nothing) AndAlso _ Not value.GetType().IsAssignableFrom(GetType(CalendarCell)) _ Then Throw New InvalidCastException("Must be a CalendarCell") End If MyBase.CellTemplate = value End Set End Property End Class Public Class CalendarCell Inherits DataGridViewTextBoxCell Public Sub New() ' Use the short date format. Me.Style.Format = "d" End Sub Public Overrides Sub InitializeEditingControl(ByVal rowIndex As Integer, _ ByVal initialFormattedValue As Object, _ ByVal dataGridViewCellStyle As DataGridViewCellStyle) ' Set the value of the editing control to the current cell value. MyBase.InitializeEditingControl(rowIndex, initialFormattedValue, _ dataGridViewCellStyle) Dim ctl As CalendarEditingControl = _ CType(DataGridView.EditingControl, CalendarEditingControl) ' Use the default row value when Value property is null. If (Me.Value Is Nothing) Then ctl.Value = CType(Me.DefaultNewRowValue, DateTime) Else ctl.Value = CType(Me.Value, DateTime) End If End Sub Public Overrides ReadOnly Property EditType() As Type Get ' Return the type of the editing control that CalendarCell uses. Return GetType(CalendarEditingControl) End Get End Property Public Overrides ReadOnly Property ValueType() As Type Get ' Return the type of the value that CalendarCell contains. Return GetType(DateTime) End Get End Property Public Overrides ReadOnly Property DefaultNewRowValue() As Object Get ' Use the current date and time as the default value. Return DateTime.Now End Get End Property End Class Class CalendarEditingControl Inherits DateTimePicker Implements IDataGridViewEditingControl Private dataGridViewControl As DataGridView Private valueIsChanged As Boolean = False Private rowIndexNum As Integer Public Sub New() Me.Format = DateTimePickerFormat.Short End Sub Public Property EditingControlFormattedValue() As Object _ Implements IDataGridViewEditingControl.EditingControlFormattedValue Get Return Me.Value.ToShortDateString() End Get Set(ByVal value As Object) Try ' This will throw an exception of the string is ' null, empty, or not in the format of a date. Me.Value = DateTime.Parse(CStr(value)) Catch ' In the case of an exception, just use the default ' value so we're not left with a null value. Me.Value = DateTime.Now End Try End Set End Property Public Function GetEditingControlFormattedValue(ByVal context _ As DataGridViewDataErrorContexts) As Object _ Implements IDataGridViewEditingControl.GetEditingControlFormattedValue Return Me.Value.ToShortDateString() End Function Public Sub ApplyCellStyleToEditingControl(ByVal dataGridViewCellStyle As _ DataGridViewCellStyle) _ Implements IDataGridViewEditingControl.ApplyCellStyleToEditingControl Me.Font = dataGridViewCellStyle.Font Me.CalendarForeColor = dataGridViewCellStyle.ForeColor Me.CalendarMonthBackground = dataGridViewCellStyle.BackColor End Sub Public Property EditingControlRowIndex() As Integer _ Implements IDataGridViewEditingControl.EditingControlRowIndex Get Return rowIndexNum End Get Set(ByVal value As Integer) rowIndexNum = value End Set End Property Public Function EditingControlWantsInputKey(ByVal key As Keys, _ ByVal dataGridViewWantsInputKey As Boolean) As Boolean _ Implements IDataGridViewEditingControl.EditingControlWantsInputKey ' Let the DateTimePicker handle the keys listed. Select Case key And Keys.KeyCode Case Keys.Left, Keys.Up, Keys.Down, Keys.Right, _ Keys.Home, Keys.End, Keys.PageDown, Keys.PageUp Return True Case Else Return Not dataGridViewWantsInputKey End Select End Function Public Sub PrepareEditingControlForEdit(ByVal selectAll As Boolean) _ Implements IDataGridViewEditingControl.PrepareEditingControlForEdit ' No preparation needs to be done. End Sub Public ReadOnly Property RepositionEditingControlOnValueChange() _ As Boolean Implements _ IDataGridViewEditingControl.RepositionEditingControlOnValueChange Get Return False End Get End Property Public Property EditingControlDataGridView() As DataGridView _ Implements IDataGridViewEditingControl.EditingControlDataGridView Get Return dataGridViewControl End Get Set(ByVal value As DataGridView) dataGridViewControl = value End Set End Property Public Property EditingControlValueChanged() As Boolean _ Implements IDataGridViewEditingControl.EditingControlValueChanged Get Return valueIsChanged End Get Set(ByVal value As Boolean) valueIsChanged = value End Set End Property Public ReadOnly Property EditingControlCursor() As Cursor _ Implements IDataGridViewEditingControl.EditingPanelCursor Get Return MyBase.Cursor End Get End Property Protected Overrides Sub OnValueChanged(ByVal eventargs As EventArgs) ' Notify the DataGridView that the contents of the cell have changed. valueIsChanged = True Me.EditingControlDataGridView.NotifyCurrentCellDirty(True) MyBase.OnValueChanged(eventargs) End Sub End Class '################################################################################################################# Public dataGridView1 As New DataGridView() Friend Sub dgv() Me.dataGridView1.Dock = DockStyle.Fill Me.Controls.Add(Me.dataGridView1) Me.Text = "DataGridView calendar column demo" Dim col As New CalendarColumn() Me.dataGridView1.Columns.Add(col) Me.dataGridView1.RowCount = 5 Dim row As DataGridViewRow For Each row In Me.dataGridView1.Rows row.Cells(0).Value = DateTime.Now Next row End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'avvia il datagridview. Call dgv() End Sub End Class apri un nuovo progetto, e nel codice del Form1 ci incolli il codice di esempio sopra
If ok Then GOTO Avanza else GOTO Inizia