title: Can I insert DatagridView configuration on module for minify Form1 code?
body: <p>I have program CRUD, and I design DataGridView like this</p>
  
  <pre><code>    Sub DG_Barang()
      With DataGridBarang
          .RowHeadersVisible = False
          .AllowUserToAddRows = False
          .ReadOnly = True
          .DataSource = DT
          .Columns(0).HeaderCell.Value = "Kode Barang"
          .Columns(1).HeaderCell.Value = "Nama Barang"
          .Columns(2).HeaderCell.Value = "Jenis Barang"
          .Columns(3).HeaderCell.Value = "Harga Beli"
          .Columns(4).HeaderCell.Value = "Harga Jual"
          .Columns(5).HeaderCell.Value = "QTY"
          .Columns(6).HeaderCell.Value = "Tgl Update"
          .Columns(0).Width = 110
          .Columns(1).Width = 238
          .Columns(2).Width = 120
          .Columns(3).Width = 120
          .Columns(4).Width = 120
          .Columns(5).Width = 50
          .Columns(6).Width = 100
          .Columns(3).DefaultCellStyle.Format = "C"
          .Columns(4).DefaultCellStyle.Format = "C"
          .Columns(0).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
          .Columns(2).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
          .Columns(3).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
          .Columns(4).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
          .Columns(5).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
          .Columns(6).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
      End With
  End Sub
  </code></pre>
  
  <p>can I create a module that contain these code and call it on form1?</p>