Adding List of Objects to Dropdown Combobox in Visual Basic - vb.net

I am pretty new to Visual Basic and mostly create through trial and error but I've been attempting this for about 5 hours now and have had no luck. I am trying to create a program used at events for runners. It has multiple forms. There are two forms to create Runners and Races. These are then stored in the Runner and Race Collection Lists. I want to populate a dropdown box with the races that are stored in the race collection list. The closet I have got to achieving this so far is the dropdown displaying "{}collection". I have tried .datasource, .add and .addRange. None seem to work.
My race collection code is:
Public Class RaceList
Inherits System.Collections.CollectionBase
Public Sub Add(ByVal aRace As Race, Optional ByVal key As String = "NewRace")
List.Add(aRace)
End Sub
Public ReadOnly Property Item(ByVal index As Integer) As Race
Get
Return CType(List.Item(index), Race)
End Get
End Property
End Class
it should simply allow the user to add too and return races in the list.
Here is the code that allows the user to add a race to the list:
Public Class newRaceForm
Public Shared racelist As New RaceList
Private Sub uiBtnAddNewRace_Click(sender As System.Object, e As System.EventArgs) Handles uiBtnAddNewRace.Click
uiDTPRaceDate.Text = Today
Dim x As Date
Dim champ As Boolean = False
x = uiDTPRaceDate.Text
If uiCheckboxChampion.Checked = True Then
champ = True
End If
Dim race As New Race(x, champ)
uiCheckboxChampion.Checked = False
MsgBox("Race Added")
racelist.Add(race, race.uniqueRaceID)
End Sub
Finally, Here is the code on the form_load that should populate the box with the contents of racelist.
Private Sub finishRaceForm_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim x = 0
Dim races As New RaceList
While x < races.Count
uiDropDownRace.Items.Add(races.Item(x).ToString)
x = x + 1
End While
End Sub
Also, my races class is created as such:
Public Class Race
Private raceDate As String
Private isChampionship As Boolean
Public Shared RaceID As Integer = 0
Public uniqueRaceID As String
Sub New(ByVal x As String, champ As Boolean)
raceDate = x
If champ = True Then
isChampionship = True
Else
isChampionship = False
End If
RaceID = RaceID + 1
uniqueRaceID = "RaceID0" + RaceID.ToString
End Sub
End Class

Whenever you add an object to a list box or drop down list, the the ToString function is called, to determine what is going to be shown.
Most objects default to returning their type name as their ToString Function. You can overrride the ToString function to display whatever you wish. In the example below, I display the text "Race Number x" where x is the race number.
Public Class Race
Private raceDate As String
Private isChampionship As Boolean
Public Shared RaceID As Integer = 0
Public uniqueRaceID As String
Sub New(ByVal x As String, champ As Boolean)
raceDate = x
If champ = True Then
isChampionship = True
Else
isChampionship = False
End If
RaceID = RaceID + 1
uniqueRaceID = "RaceID0" + RaceID.ToString
End Sub
Public Overloads Function ToString() As String
Return "Race Number " & RaceID.ToString()
End Function
End Class

I'm working on a similar program and got it to work by using this.
Dim CmbAcro As String() = {"INSERT", "THE", "ITEMS", "YOU", "WANT", "TO", "ADD", "TO", "A", "COMBO", "BOX"}
Dim cmb As New DataGridViewComboBoxColumn()
cmb.HeaderText = "INSERT HEADER TEXT HERE"
cmb.Name = "INSERT NAME HERE"
cmb.MaxDropDownItems = 20
cmb.Sorted = True
For Each i In CmbAcro
cmb.Items.Add(i)
Next
DataGridView1.Columns.Add(cmb)

Related

lists on custom listview are all the same, should be different in Visual Basic

How to display a list on a custom listview that varies like this :
true
Not like this:
false
where to see each other, everything is the same?
I created Daftar.vb using User Controls (Windows Forms) and I created a custom list view using FlowLayoutPanel and in it I entered the Daftar Toolbox
code :
Daftar.vb
Imports System.ComponentModel
Public Class Daftar1
#Region "Properties"
Private _title As String
Private _message As String
Private _icon As Image
<Category("Custom Props")>
Public Property Title As String
Get
Return _title
End Get
Set(ByVal value As String)
_title = value
judul.Text = value
End Set
End Property
<Category("Custom Props")>
Public Property Message As String
Get
Return _message
End Get
Set(ByVal value As String)
_message = value
deskripsi.Text = value
End Set
End Property
<Category("Custom Props")>
Public Property Icon As Image
Get
Return _icon
End Get
Set(ByVal value As Image)
_icon = value
gambar.Image = value
End Set
End Property
#End Region
End Class
RestaurantApp.vb
Public Class RestaurantApp
Private Sub PopulateItems()
Dim listItems As Daftar1() = New Daftar1(20) {}
Dim i As Integer
For i = 0 To listItems.Length - 1
listItems(i) = New Daftar1()
listItems(i).Title = "vdsvhd"
listItems(i).Message = "Penjelasan"
If i <> 0 Then
panelDaftar.Controls.Add(listItems(i))
End If
Next
End Sub
Private Sub RestaurantApp_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Call Me.PopulateItems()
End Sub
End Class
After I search on Stackoverflow and Youtube, I've managed to find the answer. The following is the code for RestaurantApp.vb :
Public Class RestaurantApp
Private Sub PopulateItems()
Dim listItems As Daftar1() = New Daftar1(5) {}
Dim judul As String() = New String(4) {"Burger", "Sosis", "Nasi", "Pizza", "Ayam"}
Dim penjelasan As String() = New String(4) {"a", "b", "c", "d", "e"}
Dim i As Integer
For i = 0 To listItems.Length - 1
If i < judul.Length And i < penjelasan.Length Then
listItems(i) = New Daftar1()
listItems(i).Title = judul(i)
listItems(i).Message = penjelasan(i)
If i <> 0 Then
panelDaftar.Controls.Add(listItems(i))
End If
End If
Next
End Sub
Private Sub RestaurantApp_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Call Me.PopulateItems()
End Sub
End Class
Thank you #anu6is and Stackoverflow

How to fill a datagridview with objects of a class

Okay so I think I've confused myself. I'm working on a class inventory database. My plan is to have a person enter their information and a book's info into the textboxes, and I want that informationan to be placed into the lstbox (basically saying who is now renting this book). I also have a Datagridview where I want my txtfile to open up in and display the books, but only the objects that are in my txtfile (Title, Author, ISBN, YearPublishished). I tried to do it with a query but it doesn't seem to be working.
I have a few errors that I need help with
When I start the application and click on display books. My OFD opens and I click the txtfile I need, but it doesnt display to my DataGridView properly. IT only shows numbers going down the columns.
We had to use objects of classes, and I just want to know if Im using them correctly. This is my first time doing this so any help would be appreciated.
I've attached a picture of my Application
Okay so this what I have so far:
Public Class Library
Implements IComparable
'Private Instance Variables - Always declared as Private
Private m_Title As String
Private m_Author As String
Private m_ISBN As String
Private m_YearPublished As Date
Private m_DateRented As Date 'use maskedtxtbox for dates and phone number
Private m_DueDate As Date
Private m_Name As String
Private m_Email As String
Private m_PhoneNumber As String
Private Shared LibraryCount As Integer
'Property Blocks for each Private Instance Variable
Public Property Title() As String
Get
Return m_Title
End Get
Set(value As String)
m_Title = value
End Set
End Property
Public Property Author() As String
Get
Return m_Author
End Get
Set(value As String)
m_Author = value
End Set
End Property
Public Property ISBN As String
Get
Return m_ISBN
End Get
Set(value As String)
m_ISBN = value
End Set
End Property
Public Property YearPublished As Date
Get
Return m_YearPublished
End Get
Set(value As Date)
m_YearPublished = value
End Set
End Property
Public Property DateRented As Date
Get
Return m_DateRented
End Get
Set(value As Date)
m_DateRented = value
End Set
End Property
Public Property DueDate As Date
Get
Return m_DueDate
End Get
Set(value As Date)
m_DueDate = value
End Set
End Property
Public Property Name As String
Get
Return m_Name
End Get
Set(value As String)
m_Name = value
End Set
End Property
Public Property Email As String
Get
Return m_Email
End Get
Set(value As String)
m_Email = value
End Set
End Property
Public Property PhoneNumber As String
Get
Return m_PhoneNumber
End Get
Set(value As String)
m_PhoneNumber = value
End Set
End Property
Public Sub New()
m_Title = ("")
m_Author = ""
m_ISBN = ""
m_DateRented = ""
m_DueDate = ""
m_Name = ""
m_Email = ""
m_PhoneNumber = 0
LibraryCount += 1
End Sub
'Overloaded /Parameterized Constructors
Public Sub New(ByVal p_Title As String, ByVal p_Author As String, ByVal p_ISBN As String, ByVal p_YearPublished As Date,
ByVal p_DateRented As Date, ByVal p_DueDate As Date, ByVal p_Name As String, ByVal p_Email As String, ByVal p_PhoneNumber As String)
m_Title = p_Title
m_Author = p_Author
m_ISBN = p_ISBN
m_YearPublished = p_YearPublished
m_DateRented = p_DateRented
m_DueDate = p_DueDate
m_Name = p_Name
m_Email = p_Email
m_PhoneNumber = p_PhoneNumber
LibraryCount += 1
End Sub
'QUESTION? How would I calculate when the books is due
' Public Function CalcDueDate() As String 'person gets charged if they are late returning the book
' If m_DateRented.Date > m_DueDate.Date Then
'm_DueDate = m_DateRented + 10
'MessageBox.Show("You will be charged with a late of .50 cents")
'End If
'End Function
Public Overrides Function ToString() As String
Return "The user rented a book on" & DateRented & " it will be due on" & DueDate
End Function
Public Function CalcDueDate(ByVal p_DueDate As Date) As Date
Return p_DueDate
End Function
Public Function CompareTo(obj As Object) As Integer Implements IComparable.CompareTo
Throw New NotImplementedException()
Return m_YearPublished.CompareTo(CType(obj, Library).m_YearPublished)
End Function
Public Overrides Function Equals(obj As Object) As Boolean
'create a library object from the paramer - check to see if it exist
Dim libraryobj As Library = TryCast(obj, Library)
If libraryobj Is Nothing Then
Return False
Else
'code for the comparison based on m_yearpublished
Return m_YearPublished.Equals(libraryobj.m_YearPublished)
End If
End Function
End Class
End Class
Public Class Project1Data
'create counter variable for the array
Dim counter As Integer = 0
'create an array of objects
Private books(12) As Library
'Collection List
Dim mybooklist As New List(Of Library)
Dim abook As Library
Private Sub btnDisplayBooks_Click(sender As Object, e As EventArgs) Handles btnDisplayBooks.Click
Dim textfile As String
OpenFileDialog1.ShowDialog()
textfile = OpenFileDialog1.FileName
DGVbooks.DataSource = IO.File.ReadAllLines("LibraryDatabase")
End Sub
Public Sub Data()
End Sub
Private Sub btnAdd_Click(sender As Object, e As EventArgs) Handles btnAdd.Click
'The Btn_Add method creates a Renter and book and adds it to the collectio
'validate input data
If ValidateData() = -1 Then
Exit Sub
End If
'use valid input to create an object of the class by calling overloaded constructor
Dim bookk As New Library(txtbooktitle.Text, txtbookauthor.Text, txtISBN.Text, CDate(txtyearpublished.Text),
CDate(txtdaterented.Text), CDate(txtduedate.Text), txtname.Text, txtemail.Text, (txtphonenunber.Text))
'error check that the array is not full
If counter >= books.Length Then
ReDim Preserve books(counter + 1)
End If
'add book to the array
books(counter) = bookk
'add book to the list
mybooklist.Add(bookk)
'increment counter
counter = counter + 1
'Notify user that the rental has been recorder
MessageBox.Show("Rental recorded")
lstbooksoutput.DataSource = Nothing
lstbooksoutput.DataSource = books
End Sub
Private Sub Project1Data_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim lines() As String = IO.File.ReadAllLines("LibraryDatabase")
'In the DGV I just want to display the title, author, isbn, and year published
' In the lstbox the user name, email, and phone number will be displayed
'When a user enters a new book it adds itself to the DGV
Dim query = From abook In books
Select abook.Title, abook.Author, abook.ISBN, abook.YearPublished
Order By abook.YearPublished Ascending
DGVbooks.DataSource = query.ToList()
Okay here is where I created an objectof the class using an overload constructor, and I thought I sent it it to the datagridview but its not showing.
'Populate a list with Library objects
With mybooklist
.Add(New Library("Innoncent Injustice(A Chance Reddick Thriller Book 1), David Archer,B07D6442LM", 2018))
.Add(New Library("A Breath Of Witchy Air(A Wicked Witches Of the Midwest Mystery), Amanda M Lee, B07CRLRGXH", 2018))
.Add(New Library("Booke Of the Hidden, Jeri Westerson, 978 - 1635760507", 2017))
.Add(New Library("Wolves Of Wisteria(Wisteria Witches Mystery), Angela Pepper,978-1719549591", 2018))
.Add(New Library("Soul Render(Soul Stones Book 1), TL Branson,978-1980871392", 2018))
.Add(New Library("A Thrift Shop Murder(Cats And Ghosts And Avocado Toasts Book 1), Stanford Pritchard,978-1773480114", 2018))
.Add(New Library("Cathadeus, Jeff J Peters,B077ZNHY7T", 2017))
.Add(New Library("Clockwork Alchemist (Thief's Apprenctice Series Book 1), Sara C. Roethle,B01MG26KNA", 2016))
.Add(New Library("Air Awakens Series, Elise Kova,B01N4A2TK5", 2016))
.Add(New Library("Keeper of the Dragons The Prince Returns (Keeper of Dragons Book 1), J.A Cullican,B01FYL5BD0", 2016))
.Add(New Library("Nightblade A Book of UnderRealm, Garrett Robinson,978-1941076309", 2014))
.Add(New Library("Crazy Rich Asians, Kevin Kwan,B00AP2VQEM", 2013))
.Add(New Library("Poison Princess (The Arcana Chronicles Book 1), Kresley Cole,978-1442436640", 2012))
End With
DGVbooks.DataSource = query.ToList
DGVbooks.Columns("Title").HeaderText = "Title"
DGVbooks.Columns("Author").HeaderText = "Author"
DGVbooks.Columns("ISBN").HeaderText = "ISBN"
DGVbooks.Columns("Year Publsihed").HeaderText = "Year Published"
DGVbooks.DataSource = mybooklist
End Sub
Function ValidateData() As Integer
'This validates the data in all of the textboxes
'Invalid data returns a -1, else 1
If txtbooktitle.Text = "" Then
MessageBox.Show("Please enter a Book Title")
Return -1
ElseIf txtbookauthor.Text = "" Then
MessageBox.Show("Please enter a Book Title")
Return -1
ElseIf txtdaterented.Text = "" Or IsNumeric(txtdaterented.Text) = False Then
MessageBox.Show("Please enter a valid date")
Return -1
ElseIf txtduedate.Text = "" Or IsNumeric(txtduedate.Text) = False Then
MessageBox.Show("Please enter a valid date")
Return -1
ElseIf txtyearpublished.Text = "" Or IsNumeric(txtyearpublished.Text) = False Then
MessageBox.Show("Please enter a valid date")
Return -1
ElseIf txtname.Text = "" Then
MessageBox.Show("Please enter a name")
Return -1
ElseIf txtemail.Text = "" Then
MessageBox.Show("Please enter a valid email")
Return -1
ElseIf txtphonenunber.Text = "" Or IsNumeric(txtphonenunber.Text) = False Then
MessageBox.Show("Please enter a valid phone number")
Return -1
Else
Return 1
End If
End Function
Private Sub lstbooksoutput_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstbooksoutput.SelectedIndexChanged
If lstbooksoutput.SelectedIndex > -1 Then
Dim intbook As Integer = lstbooksoutput.SelectedIndex
'get information for that user in the array
MessageBox.Show(books(intbook).Name & " has rented" & books(intbook).Title & ". The book will be due on " & books(intbook).DueDate)
End If
End Sub
Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click
'clear the textboxes
txtbooktitle.Clear()
txtbookauthor.Clear()
txtISBN.Clear()
txtdaterented.Clear()
txtduedate.Clear()
txtyearpublished.Clear()
txtname.Clear()
txtemail.Clear()
txtphonenunber.Clear()
'reset focus to title box
txtbooktitle.Focus()
End Sub
End Class
enter image description here
Ok Sydney, let's get this thing working!
Either you have seriously ignored your studies or your instructor
has left you to flounder; in which case you should notify your
college that you are not getting what you are paying for.
Your object contains too much data. You need a book object, a customer object and a rental object. Suppose the library director
wants a list of all your clients. In your model you would have each
client listed many times and it would be a mess to get the director
his list.
Use Automatic Properties if you can. I think they are available in VS 2015. You only need to write Public Property Title as String
and the wonderful vb compiler will write the get, set, and the
private field for you in the Itermedite Language code. (You won't
see it in your source code but it is there)
Now your text file. One line per book. Each property of the book should be separated by a character that does not appear elsewhere in
the file. How about the pipe character (|) (the uppercase backslash)
So a line in your file would look like... 1|Innoncent Injustice(A
Chance Reddick Thriller Book 1)|David Archer|B07D6442LM|2018 Notice
I have added another field, the BookID
I haven't included the default constructor (the one with no parameters). This forces any code creating a book object to provide
values for all parameters even if it is only "".
Public Class Book
Public Property BookID As Integer
Public Property Title As String
Public Property Author As String
Public Property ISBN As String
Public Property YearPublished As Integer
Public Sub New(id As Integer, bTitle As String, bAuthor As String, bISBN As String, bPublished As Integer)
BookID = id
Title = bTitle
Author = bAuthor
ISBN = bISBN
YearPublished = bPublished
End Sub
End Class
Public Class Project1Data
Private lstBooks As New List(Of Book)
Private Sub Project1Data_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim textfile As String
OpenFileDialog1.ShowDialog()
textfile = OpenFileDialog1.FileName
Dim lines() As String = IO.File.ReadAllLines(textfile)
For Each line As String In lines
Dim fields() As String = line.Split("|"c) 'the little c after "|" indicates that this is a char
'String.Split takes a char
Dim b As New Book(CInt(fields(0)), fields(1), fields(2), fields(3), CInt(fields(4)))
lstBooks.Add(b)
Next
DataGridView1.DataSource = lstBooks
End Sub
End Class

How to retain the 'New' constructor across subclasses?

Let's start with an example Module:
Module PuppyKillers
Public Puppies As Double = 135
Public SquadSize As Integer = 5
Class PuppyKiller
Private KillingTimer As New System.Timers.Timer _
With {.AutoReset = True, .Interval = 1000, .Enabled = False}
Public PuppiesPerSecond As Double = 0.5
Public name As String = "John Doe"
Public Sub New(Optional param As Double = 1)
PuppiesPerSecond = PuppiesPerSecond * param
AddHandler KillingTimer.Elapsed, AddressOf KillPuppies
End Sub
Private Sub KillPuppies(ByVal sender As Object, _
ByVal e As System.Timers.ElapsedEventArgs)
If Puppies <= 0 Then
Me.Killing = False
Else
Puppies -= PuppiesPerSecond
End If
End Sub
Property Killing As Boolean
Get
Return KillingTimer.Enabled
End Get
Set(value As Boolean)
KillingTimer.Enabled = value
End Set
End Property
End Class
Class ChiefPuppyKiller
Inherits PuppyKiller
End Class
Sub Exterminators_Start() ' 4 Killers + 1 Chief
Dim squad As New ArrayList
REM The following line prevents the compilation.
squad.Add(New ChiefPuppyKiller(3)) 'A chief kills 3 times the normal amount.
For i As Integer = 1 To SquadSize - 1
squad.Add(New PuppyKiller)
Next
REM Start the slaughter
Console.WriteLine("Puppies: " & Puppies)
For Each c As PuppyKiller In squad
c.Killing = True
Next
Do
Threading.Thread.Sleep(4737)
Console.WriteLine("Remaining Puppies: " & Math.Ceiling(Puppies))
Application.DoEvents()
If Puppies = 0 Then
Console.WriteLine("Meow: No more puppies.")
Exit Do
End If
Loop
End Sub
End Module
I've a problem with the above block of code: I cannot find a way to use PuppyKiller's Constructor from its subclasses: ChiefPuppyKiller in this case.
I got an error about the number of parameters for the constructor, so I assume that the base class constructor is not used.
I don't want to declare a new New sub for every subclass. But I'd like to be able to specify the puppy killing multiplier in the constructor.
Note: no animal has been harmed while writing this question, as the code does not compile.
You are going to have to add a new constructor for every class where you want to pass that value in:
Class ChiefPuppyKiller
Inherits PuppyKiller
Public Sub New(param As Double)
MyBase.New(param)
End Sub
End Class

ArrayList change values when i add a new one VB.NET

So here is my problem. I have a Class of Products and i have created an ArrayList of that class.
I can add lot of new Products to that Array but the problem is that the Array change all the Values of the Array as the last one i have added.
Product Class:
Public Class Product
Dim cod_prod As String
Dim state As Boolean
Public Sub New(ByVal cod As String, ByVal est As Boolean)
cod_prod = cod
state = est
End Sub
Public Sub New()
cod_prod = ""
state = False
End Sub
Public Function get_cod_prod() As String
Return cod_prod
End Function
Public Function get_state() As Boolean
Return state
End Function
Public Sub set_cod_prod(ByVal cod As String)
cod_prod = cod
End Sub
Public Sub set_state(ByVal est As Boolean)
state = est
End Sub
End Class
And this class is were i add a new Product to the ArrayList.
Dim array_prod As New ArrayList
Dim nproducts As Integer = 0
Public Sub add_prod(ByVal prod As Producto)
array_prod.Add(prod)
nproducts += 1
End Sub
Thanks for help.
Ok, looking a bit more on related questions i have found this.
Retrieving data from a VB.NET arraylist of objects
So i solve it changing the method like this:
Public Sub add_prod(ByVal prod As Producto)
Dim nprod As New Producto
nprod.set_cod_prod(prod.get_cod_prod)
nprod.set_state(prod.get_state)
array_prod.Add(nprod)
nproductos += 1
End Sub

Infragistics UltraGrid summary value from cell

I have this ultraGrid:
http://s4.postimg.org/fhnjs4w4d/Capture.png
I need to pass to summary cell a custom value from column with red mark on picture.
Infragistics lets me put the Max, Min, Sum, Average, etc in summary cell, but I need to pass custom value.
Any help?
I have this code wich put Max value:
Dim columnToSummarizeVlrAq As UltraGridColumn = ugbBens.DisplayLayout.Bands(0).Columns(ugbBensColVlrAq)
Dim summaryVlrAq As SummarySettings = .Add(ugbBensColVlrAq,SummaryType.Maximum, columnToSummarizeVlrAq, SummaryPosition.UseSummaryPositionColumn)
Here the solution :
Create a new class:
Public Class MyCustomSummarySettings
Implements ICustomSummaryCalculator
Private valor As Object = 0
Public Sub New()
End Sub
Public Sub Val()
End Sub
Private Sub BeginCustomSummary(ByVal summarySettings As SummarySettings, ByVal rows As RowsCollection) Implements ICustomSummaryCalculator.BeginCustomSummary
valor = 0
End Sub
Private Sub AggregateCustomSummary(ByVal summarySettings As SummarySettings, ByVal row As UltraGridRow) Implements ICustomSummaryCalculator.AggregateCustomSummary
'Primeiro mês
If summarySettings.Key = "COL_DeprAntExVlrRv" Then
If row.Index = 0 Then valor = CDbl(row.Cells("COL_DeprAntExVlrRv").Value)
End If
If summarySettings.Key = "fltVlrDepreciavelAct" Then
If row.Index = 0 Then valor = CDbl(row.Cells("fltVlrDepreciavelAct").Value)
End If
End Sub
Private Function EndCustomSummary(ByVal summarySettings As SummarySettings, ByVal rows As RowsCollection) As Object Implements ICustomSummaryCalculator.EndCustomSummary
Return valor
End Function
End Class
And call class with summary type custom, like this:
Dim custumSummary As New MyCustomSummarySettings
summaryDepreciavel = .Add(ugbBensColDepreciavelAceite, SummaryType.Custom, custumSummary, columnToSummarizeDepreciavel, SummaryPosition.UseSummaryPositionColumn, Nothing) '7ª Coluna
Dim custumSummary As New MyCustomSummarySettings
summaryDepreciavel = .Add(ugbBensColDepreciavelAceite, SummaryType.Custom, custumSummary, columnToSummarizeDepreciavel, SummaryPosition.UseSummaryPositionColumn, Nothing)