473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Table Builder...

I am trying to create a set of functions so that I can dynamically and
programmatically create a table.

The table will be a calendar when it is displayed on the screen and has 5
types of cells.. Month header, Date, Info, Contents, and Filler.

This is the code that I am using:

Private Sub Page_Load(...

Build Calendar()

End Sub

Private Sub BuildCalender()

Table1.Rows.Add(BuildRow(1,Today())

End Sub

Function BuildRow(byval type as integer, byval sDate as Date) as TableRow
BuildRow.Cells.Add(BuildCell(1,1))
End Function

Function BuildCell(byval type as integer, byval contents as integer) as
TableCell

Select Case Type
Case 1 ' Month
BuildCell.BorderStyle = BorderStyle.Ridge
BuildCell.BackColor = BuildCell.BorderColor
BuildCell.Text = "Test Month Text"
BuildCell.Height.Pixel(24)
BuildCell.RowSpan = 14
End Select
End Function
When I try to run this I get an error "Object reference not set to an
instance of an object." on line 41 which is
BuildRow.Cells.Add(BuildCell(1,1))

Any help with this would be great!

Thanks in advance,

GaryO

Nov 21 '05 #1
1 1065
"Gary L. Olivieri" <Ga***@bridgecapitalusvi.com> wrote in message
news:BF4DAD41.1DC0%Ga***@bridgecapitalusvi.com...
.. . .
Function BuildRow(byval type as integer, byval sDate as Date) as TableRow
BuildRow.Cells.Add(BuildCell(1,1))
End Function


Within the BuildRow Function, you get a "free" variable, with the
same name as the function to use as its return value. But, in this case,
that return value is still an Object and you have to instantiate it before
you can call methods on it, something like

Function BuildRow( _
byval type as integer _
, byval sDate as Date _
) as TableRow
' Not sure what you do with "type" (dodgy name) and sDate, but

BuildRow = New TableRow()

BuildRow.Cells.Add(BuildCell(1,1))

Return BuildRow
End Function

HTH,
Phill W.
Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Radek Michalski | last post by:
Hi! I'm looking for a macro, that let me pass trough all rows in table (ID int - key, string Name) and everytime calls a query with a Name (or ID) as parameter. I can't find this kind of macro....
14
by: John T Ingato | last post by:
I have a contacts table with name address and such but are missing all phone numbers in the phone number fields. I have just received an updated customer list in Excel and have imported into a new...
2
by: me | last post by:
I have written a query that joins four or five tables. One table has 30,000 rows. Another table has only 200. I want to only return the 200 or so rows in the smaller table and columns from the...
2
by: travhale | last post by:
in a new project using .net 2005, c#. getting err message "Update requires a valid UpdateCommand when passed DataRow collection with modified rows." source RDBMS is oracle 8i. I add a new...
4
by: Bob | last post by:
Hi all, I'm trying to import data, modify the data then insert it into a new table. The code below works fine for it but it takes a really long time for 15,000 odd records. Is there a way I...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.