Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
C# / VB.NET - Gestione camere albergo VB2008
Forum - C# / VB.NET - Gestione camere albergo VB2008 - Pagina 2

Pagine: [ 1 2 3 ] Precedente | Prossimo
Avatar
Thejuster (Admin)
Guru^2


Messaggi: 2305
Iscritto: 04/05/2008

Segnala al moderatore
Postato alle 10:30
Venerdì, 02/04/2010
uhm il problema e che un linguaggio va studiato.
va appreso e sopratutto in ogni suo minimo particolare per ottenere
i risultati sperati.

queste sono operazioni basilari, del tipo cambiare il nome dei campi di un Datagrid.

se non sei in grado di fare semplici operazioni come queste,
dubito che riuscirai a sviluppare programma del genere completo.

cmq ti basta andare sulle proprietà del controllo e da li puoi rinominare i campi come meglio credi.


https://mire.forumfree.it/ - Mire Engine
C# UI Designer
PM Quote
Avatar
Il Totem (Admin)
Guru^2


Messaggi: 3635
Iscritto: 24/01/2006

Segnala al moderatore
Postato alle 10:36
Venerdì, 02/04/2010
Il codice funziona, solo che non lo sai usare nel modo corretto.
Per mettere i numeri a lato, basta impostare correttamente il valore HeaderCell.Value di ogni riga. Ad esempio così:
Codice sorgente - presumibilmente VB.NET

  1. Dim Camere As Int32() = {101, 102, 108, 203, 207}
  2. For Each Row As DataGridViewRow In Data.Rows
  3.    If Row.Index < Camere.Length Then
  4.       Row.HeaderCell.Value = Camere(Row.Index)
  5.    End If
  6. Next



Un "esempio concreto" varrebbe a dire che dovrei scriverti tutto il codice...

PM Quote
Avatar
okins (Normal User)
Newbie


Messaggi: 12
Iscritto: 28/03/2010

Segnala al moderatore
Postato alle 13:03
Venerdì, 02/04/2010
ma dov'è ke sbaglio?


okins ha allegato un file: camere.zip (131101 bytes)
Clicca qui per scaricare il file

Ultima modifica effettuata da okins il 02/04/2010 alle 13:11
PM Quote
Avatar
Il Totem (Admin)
Guru^2


Messaggi: 3635
Iscritto: 24/01/2006

Segnala al moderatore
Postato alle 10:53
Sabato, 03/04/2010
Il for enumera le righe della datagridview: peccato che all'inizio non ce ne siano, dato che il controllo è vuoto. Prime le devi aggiungere.

PM Quote
Avatar
okins (Normal User)
Newbie


Messaggi: 12
Iscritto: 28/03/2010

Segnala al moderatore
Postato alle 14:59
Sabato, 03/04/2010
scusate se ve lo chiedo...non è che me lo puoi correggee e mandarmelo?Per favore...

PM Quote
Avatar
salva94 (Normal User)
Rookie


Messaggi: 57
Iscritto: 02/01/2010

Segnala al moderatore
Postato alle 19:14
Sabato, 03/04/2010
Io ho cercato di fare il code sono arrivato fin qui :
Codice sorgente - presumibilmente VB.NET

  1. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  2.         Label1.Text = DateTimePicker1.Value.Month
  3.         Dim giorni As Int32
  4.         giorni = DateTime.DaysInMonth(DateTimePicker1.Value.Year, DateTimePicker1.Value.Month)
  5.         For i As Integer = 1 To giorni
  6.             Data.Columns.Add("Colonna", i)
  7.  
  8.  
  9.  
  10.  
  11.         Next
  12.  
  13.  
  14.  
  15.  
  16.     End Sub
  17.  
  18.  
  19.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  20.         For i As Integer = 1 To TextBox1.Text
  21.             Data.Rows.Add()
  22.  
  23.         Next
  24.  
  25.  
  26.     End Sub
  27.  
  28.     Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
  29.  
  30.     End Sub
  31.  
  32.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  33.         Data.Rows.Clear()
  34.         Data.Columns.Clear()
  35.  
  36.  
  37.         Dim giorni As Int32
  38.         giorni = DateTime.DaysInMonth(DateTimePicker1.Value.Year, DateTimePicker1.Value.Month)
  39.         For i As Integer = 1 To giorni
  40.             Data.Columns.Add("Suti", i)
  41.  
  42.         Next
  43.         Try
  44.             For i As Integer = 1 To TextBox1.Text
  45.                 Data.Rows.Add()
  46.  
  47.             Next
  48.         Catch ex As Exception
  49.  
  50.         End Try
  51.     End Sub
  52.  
  53.     Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged
  54.         Label1.Text = DateTimePicker1.Value.Month
  55.     End Sub
  56.  
  57.     Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
  58.         If Label1.Text = "1" Then
  59.             Label1.Text = "Gennaio"
  60.  
  61.         End If
  62.         If Label1.Text = "2" Then
  63.             Label1.Text = "Febbraio"
  64.  
  65.         End If
  66.         If Label1.Text = "3" Then
  67.             Label1.Text = "Marzo"
  68.  
  69.         End If
  70.         If Label1.Text = "4" Then
  71.             Label1.Text = "Aprile"
  72.  
  73.         End If
  74.         If Label1.Text = "5" Then
  75.             Label1.Text = "Maggio"
  76.  
  77.         End If
  78.         If Label1.Text = "6" Then
  79.             Label1.Text = "Giugno"
  80.  
  81.         End If
  82.         If Label1.Text = "7" Then
  83.             Label1.Text = "Luglio"
  84.  
  85.         End If
  86.         If Label1.Text = "8" Then
  87.             Label1.Text = "Agosto"
  88.  
  89.         End If
  90.         If Label1.Text = "9" Then
  91.             Label1.Text = "Settembre"
  92.  
  93.         End If
  94.         If Label1.Text = "10" Then
  95.             Label1.Text = "Ottobre"
  96.  
  97.         End If
  98.         If Label1.Text = "11" Then
  99.             Label1.Text = "Novembre"
  100.  
  101.         End If
  102.         If Label1.Text = "12" Then
  103.             Label1.Text = "Dicembre"
  104.  
  105.         End If
  106.  
  107.     End Sub
  108.  
  109.    
  110.  
  111.     Private Sub Data_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles Data.CellEndEdit
  112.         Dim cella As Int32
  113.         cella = Data.Rows.Count * Data.Columns.Count
  114.         For i As Integer = 1 To cella
  115.  
  116.         Next
  117.  
  118.        
  119.  
  120.     End Sub





Ho utilizzato un Datatimepicker per gestire le griglie , e fin qui tutto bene , però salvare e individuare particolari colonne mi viene molto difficile , non avendo utilizzato mai il DateGrid non so come individuare ad esempio una cella su cui si scrive....

PM Quote
Avatar
okins (Normal User)
Newbie


Messaggi: 12
Iscritto: 28/03/2010

Segnala al moderatore
Postato alle 2:19
Domenica, 04/04/2010
salva 94...grz almeno tu sei sincero nel dire che non lo sai fare:D

PM Quote
Avatar
Il Totem (Admin)
Guru^2


Messaggi: 3635
Iscritto: 24/01/2006

Segnala al moderatore
Postato alle 15:01
Domenica, 04/04/2010
Con questo vorresti dire che sto solo prendendo tempo perchè non lo so fare?

A differenza di altri, io non sono solo chiacchere e niente fatti.


Il Totem ha allegato un file: DataGridView.zip (71297 bytes)
Clicca qui per scaricare il file
PM Quote
Pagine: [ 1 2 3 ] Precedente | Prossimo