Add The Date Ranges Into My Structure?

Jun 30, 2009

I am creating a program that takes into account pay from a job. I will try to describe the problem I am having using some psuedo code - so dont take syntax too seriously.

I created a structure that has some of the following values:
Name as String
Amount as Double
FrequencyType as MyEnumerator

MyEnumerator looks like this:
EveryTwoWeeks = 1
TwiceAMonth = 2
Weekly = 3

Now my problem is how do I add the date ranges into my structure?If your pay is weekly or twice a week, then I just need a single date because all other paydays should increment in 1 or 2 week blocks. But if the pay is twice a month I need two dates. It seems like there has got to be a better way then just having two dates in my structure and knowing that you just need the 2nd date if the FrequencyType is = 2 (TwiceAMonth).I was thinking that instead of a Structure I should use a class and then I could create a function that returns the date or dates depending on the enumeration type that you pass into it.What would be the "correct" way of doing this? I think I need a type of enumerator that allows for more then just integer type values.

[code]...

View 2 Replies


ADVERTISEMENT

Date Ranges - Limit The Date Entered Into A Form

Jun 21, 2010

What I am trying to create is a log in system, and in one of my forms I want to limit the date entered into a form. For example a user cannot enter a date more than seven days from todays date Which is what i achieved but what i am stuck on is preventing a user entering a date in the future

[Code]...

View 5 Replies

VS 2010 Get Week Date Ranges Of A Specific Date?

Mar 16, 2012

I am writing a personal accountant software using VB2010. What I'm looking for now is to get the week date range of a specific date (Monday to Sunday). For example, if the given date is 16/03/2012, I want to get back:12/03/2012 -> 18/03/2012

View 5 Replies

Compare To Date Ranges?

Feb 21, 2012

I am developing a billing application to help out the billing lady who has been doing our billing by hand. I am essentially done�. Except for one class of customer I can�t wrap my head around. Nuts and Bolts:

1.Data comes from a table that shows Storage id, customer id, Billing Start date, Billing end date.

2.I am kicking the data back out to a table and I�ll build her a nice little crystal she can run.

Problem:We rent storage space. If multiple customers use the same storage then they will split the cost of the daily fee. If there is 3 customers they each pay a third etc. This seems simple but If Customer 1 starts on 1/1/12 and ends 1/10/12 she pays 10 days. If Customer 2 comes in 1/3/12-1/9/12 they will split 7 days. If Customer 3 comes in only on 1/9/12 then they will all pay a third on that day. Now imagine this across 600+ storage units and 1000+ customers and each customer using multiple storage at any given time.

My biggest issue is I don�t know how to express how we do that calculation by hand programmatically. By hand process and how I figure I am eating the elephant: Find every Customer that has used the Space in the billing period -Determine the unique storage numbers that were used during the billing cycle kick the results to a storage table on an access database. I am using a table because I figured it would be less of burden for the application then a list or array.

Determine where there is overlap - Use �FOR� to cycle through the orginal data table using the unigue. Here is where I am stuck. How do I compare the dates in a way to determine which customer is using it when compared to the others. Obviously i can determine the difference in dates between the start and end. It is getting the applicaiton to recognize the dates are with in the other dates. here is kind of what I was thinking obviosly this doesn't work I am just using the format so don't crush me too bad because I code like a caveman.

Dim CustomerDifference as time span
Dim UniqueStorage as Integer
Dim Customer as string

[code]....

View 4 Replies

DB/Reporting :: Filtering Date Ranges In A Report?

Aug 9, 2008

This is my first program and have absolutely no training in programming Visual Basic Studio 2008 so forgive me if I have missed something obvious.Form3 contains a StartDate(Date Time Picker1)and EndDate(Date Time Picker2) with a button1 which launches a Form4 containing a report( Microsoft Report Veiwer)

I have been able to generate a report but it gives me everything in the database instead of date range selected.I have tried generating queries,stored procedures and writing additional code but nothing seems to work.( Though I may of but them in the wrong place)

View 2 Replies

C# - Calculate Location And Number Of Intersections Between Multiple Date/time Ranges?

Apr 29, 2010

I need to calculate the location of intersections between multiple date ranges, and the number of overlapping intersections. Then I need to show which date/time ranges overlap each of those intersecting sections. It is slightly more complicated than that so I'll do my best to explain by providing an example. I am working in VB.Net, but C# examples are acceptable as well as I work in both.

We have several high risk tasks that involve the same system. Below I have three example jobs named HR1/2/3/4 with start and end date/times.

HR1 {1/6/2010 10:00 - 1/6/2010 15:00}
HR2 {1/6/2010 11:00 - 1/6/2010 18:00}
HR3 {1/6/2010 12:00 - 1/6/2010 14:00}

[Code]....

View 1 Replies

Add An Enum To An Existing .NET Structure, Like Date?

Feb 23, 2011

What I am wondering is, is it possible to create an enum and attach it to the DateTime structure? Extension Methods come instantly to mind, but I don't know of a way to pull this off using them.

Dim july As DateTime.Months = DateTime.Months.July
Public Enum Months
January = 1

[code]....

View 3 Replies

Add An Enum To An Existing NET Structure Like Date?

Oct 26, 2011

So apparently Microsoft does not have a Months Enum on their Date structure.What I am wondering is, is it possible to create an enum and attach it to the DateTime structure? Extension Methods come instantly to mind, but I don't know of a way to pull this off using them.[code]...

View 3 Replies

Convert C++ Structure _DATE_TIME To Date Value

Sep 30, 2009

Does anyone have some code that will easily convert this C++ _DATE_TIME date/time structure to a VB.NET date value ?

[Code]...

View 10 Replies

Use Icompare To Sort A Structure Of Files By Date?

Feb 18, 2010

I'm using Visual Studio .Net 2008 on Vista. The goal of my program is to watch a directory, get file information, then sort them by thier date, and produce a updated text file. I can't seem to get my code to generate a list of files sorted by date. The code does produce a general list of files, however presently ordered in the directory. I also tried an alternate way of sorting the files by date by creating a string, removing the date using substring, then comparing the file dates using datetime.parse but it produces a exception error.[code]...

View 5 Replies

VS 2010 - String To Date Conversion In Structure

Dec 27, 2010

I am trying to convert text in a text box (txtEventDate.Text) to a date type in a structure: ThisEvent.EventDate (declared as date). The text in the textbox is of the form: 05/18/1927 (i.e. May 18th, 1927) and after looking long and hard thru the forums attempting several different things, like:

'ThisEvent.EventDate = CDate(Format("#" & txtEventDate.Text & "#", "mm/dd/yyyy"))
'ThisEvent.EventDate = Date.Parse(txtEventDate.Text & "12:01:00 AM")
'Date.TryParse(txtEventDate.Text, ThisEvent.EventDate)

The code is commented out because none of them convert the string to a date value (I know a date does not have a format and I have looked thru the MSDN). How can I stay logged and composing a thread past some arbitrary time limit that forces a re-login?

View 2 Replies

Convert Forum Date And Time Strings To DateTime Structure?

Jun 7, 2011

Is there a framework class that converts the partial day strings on these forums to a DateTime? Examples are "a few seconds ago", "19 minutes ago" and 3" hours 26 minutes ago",

View 4 Replies

Date - Format Now() To This Structure.. "mdyy"

Jul 17, 2009

I want to format now() to this structure.. "mdyy"

month with no leading 0 if < 10

day with no leading 0 if < 10

View 4 Replies

How To Display The Ranges

May 1, 2009

how to display the ranges here is the assinment Your homework assignment will create a project that uses an array to store the sales figures for 20 employees at a computer store. Declare a 20-element one-dimensional array named Sales .

[Code]...

View 2 Replies

Defining Ranges For Excel In .NET?

Jun 21, 2010

I am using Excel interop in my VB.NET program. My problem is that I can't seem to figure out how to write to Excel *and* define the Range using numbers.Alright, so I have objects being created depending on the file that the user opens. So there could be 100 objects or there could be none. Now each object has an array of values, and these arrays contain nearly 15000 elements. So here is what I want to do but I can't figure out how to escape using the LetterNumber:LetterNumber combination.

For every object I want a new column to be occupied and for every element in the objects array I want the row to be occupied. I figured the easiest way to do this was using a for loop but, again, I can't use numbers.

For columns = 0 to NumberOfObjects
For rows = 0 to NumberInArray
Cell(0,0).Value = myObjectsCollection(column).Array(rows)
Next
Next

View 3 Replies

Defining Ranges For Excel?

Aug 10, 2010

I am using Excel interop in my VB.NET program. My problem is that I can't seem to figure out how to write to Excel and define the Range using numbers.

Alright, so I have objects being created depending on the file that the user opens. So there could be 100 objects or there could be none. Now each object has an array of values, and these arrays contain nearly 15000 elements. So here is what I want to do but I can't figure out how to escape using the LetterNumber:LetterNumber combination.

For every object I want a new column to be occupied and for every element in the objects array I want the row to be occupied. I figured the easiest way to do this was using a for loop but, again, I can't use numbers.

For columns = 0 to NumberOfObjects
For rows = 0 to NumberInArray
Cell(rows , columns).Value = myObjectsCollection(column).Array(rows)
Next
Next

View 1 Replies

Ranges Of Location Values?

Jun 16, 2011

What's up guys. Simple question today. How do you specify ranges of values for location? Basically i'm trying to write an if statement that will execute if a location matches a range of values, here is th snippet of my code im having trouble with:

If Player.Location = New Point(0 To 240, 240) Then code here

But that didn't work at all, there was no error, but the code just wouldn't execute when the "player" was in that range!

View 7 Replies

Structure Inside Another Structure Receives Null Reference Error?

Jan 5, 2012

Module Module1
Public Structure structure1
Public TRANS() As structure2
End Structure
Public Structure structure2
Public X() As Integer
End Structure
End Module

View 17 Replies

Class Structure - Large Structure That Has Lots Of Properties ?

Jan 5, 2010

I'm new to VB 2008 after having spent a long time with VB6, so I apologize if this is a stupid question. But I'd really like to have this straightened out.

Let's say I have a pretty large structure that has lots of properties.

Code:

Now say that I want an internal database with about 10 instances of this structure total, describing, say, 10 different products that a store sells. When these values are loaded from a database, they remain totally static. (However, they can be different each time a program loads)

Now say that I have a class. Each instance of this class is a type of that BaseProduct structure. Meaning, each instance of the class pertains to one of the 10 types of products that the store sells. However, this class has additional properties that pertain specifically to each instance, which are not static.

Code:

Now, the problem here is... If I have 200 different transactions, each one contains an instance of BaseProduct. BaseProduct is HUGE, and is largely redundant (only 10 types possible), so I think it's a little silly to include a whole copy of it with EVERY transaction. However, the Transaction class really needs information regarding the base product it pertains to. Is there a way to, instead of declaring a New BaseProduct in the Transaction class, to simply make one of the properties of the Transaction class a pointer to a BaseProduct variable?

In VB6, I would accomplish this by making a BaseProduct(10) array, and then giving each Transaction an ID number referring to an entry in that array. But in VB 2008, using class structure, this is impossible. I can't define the BaseProduct(10) array outside of a class in a namespace, and if I define it in the actual application's form, then the class loses modularity since it relies on the application that's using it.

View 11 Replies

Converting Structure Within Structure To Byte Array For Socket

Aug 29, 2009

I am trying to communicate with an external device and i am trying to send a byte array to the external device via sockets but i am always getting a response the message size is too small so i am not sure what i have done wrong. Between the data type there should be no alignment present and all numbers are represented in little endian format. The char array is not null terminated as mentioned in the protocol specifications.

I have to send data based on a struct that embeds 2 other struct. So here's my vb.net code for the struct used to convert to byte array and the sending part.

Public Structure MESSAGETYPE_OIP_Login
Dim Header() As COMMANDHEADER
Dim UserName() As PSTRING

[Code]....

View 2 Replies

.net - Linking Ranges To Item In Collection?

Aug 17, 2011

I have a collection as such

Private Shared ReadOnly thermoPaths As New ReadOnlyCollection(Of String) _
({
"thermometer_000_108x320.jpg",
"thermometer_010_108x320.jpg",
"thermometer_020_108x320.jpg",
"thermometer_030_108x320.jpg",

[Code]...

View 2 Replies

Assigning Value 'ranges' From A Richtextbox Line?

Nov 30, 2009

I am trying to make a program, where a user will input 'ranges' in a richtextbox, and then enter a value, which will be stored/categorized (in an array maybe) according to the 'range'.What I exactly mean is:

User specifies ranges by inputting this line in the richtextbox: <,10,20,30,> First range = < to 10 (no minimum boundary up to 10), second range = 10 to 20 , 3rd = 20 to 30 , 4th = 30 to > (30 to no maximum boundary) Then a user enters a number. For example "-1" would fall in the "< to 10" category, "23" in the "20 to 30" category, "125" in the "30 to >" category. I know there are other ways to do this, but I would like to see a solution (or some guidance) based on these requirements.

View 6 Replies

Doing Work On Collection Lists In Ranges?

Jun 21, 2010

I'm performing some statistics on a txt file that has multiple columns using a collection list (vb.net 2008). My files can contain 100,000+ samples per file. How would I code my function to have it perform work on the first 3000 samples and continue the calculations on every 3000 samples thereafter?

Private Sub decimationButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles decimationButton.Click
Dim lines() As String = System.IO.File.ReadAllLines(inputFileName) '("TEXT_FILE")
Dim list As New List(Of Double())

[code]....

View 1 Replies

Excel Sheet Named Ranges?

Sep 8, 2010

How to get the first row index of a named range in excel sheet from vb.net code...for example I set the column 1 of row 2 to column 5 of row 4 a range named it "MYRange" ( it is set from excel sheet )

View 1 Replies

Pasting Arrays Into Excel Ranges

Apr 12, 2012

I'm working on pasting arrays into excel ranges. Suppose I have a range: A1:A5 and an array a = {1,2,3,4,5}. I can set up the problem like this:[code]So, I got curious about the Transpose method, and whether I could construct my array properly so that I didn't need it. I found that Transpose converts my array into a 2d 1-based array (so the first element is (1,1) not (0,0) as usual).Now I'd like to know: Is there a standard VB-way other than the worksheet transpose function that I can use to build a 1-based 2D array the way Transpose does?

View 4 Replies

Union Ranges In Excel Interop

Jan 14, 2011

I want a combined Ranges. How do I combine two ranges into one?

Dim range1 as Excel.Range = osheetTemperatureData.Range("A7:"A10")
Dim range2 as Excel.Range = osheetTemperatureData.Range("C7:"C10")

Dim range3 as Excel.Range = range1 + range2 '????

View 1 Replies

Using Dictionaries With Excel Ranges As Keys?

Jan 2, 2012

The following code is excerpted from a larger procedure (the surrounding code is not relevant). why I am unable to get the second ContainsKey line to return True? Hint: try this on a worksheet with just a few populated cells to reduce looping.

For Each ws As Excel.Worksheet In Wb.Worksheets
Dim dic As New Dictionary(Of Excel.Range, String)
rngUsed = ws.UsedRange

[code]....

View 2 Replies

Working With DateTime Hour Ranges?

Aug 2, 2010

I have a variable called hour that will be used to display different text in a textbox based on what time it is. Basically, if the time falls between 12am and 3am, hour = 0, if the time is between 3am and 6am, the hour is 1, etc, breaking the day into 8 'hour's. How would I do this in vb?

View 7 Replies

Get List Of All Named Ranges In An Excel Sheet

Sep 23, 2010

how to get list of all named ranges in an excel sheet.

View 5 Replies

Invalid Structure Size When Marshalling C Structure To .NET

Apr 14, 2012

I'm experiencing a problem with the following c-structure:

typedef struct tagTEXTUREPROP
{
DWORD dwSize;

[Code].....

The Marshal.SizeOf obviously calculates a size of 76 and it works with the DLL function, but it leaves me with some bad feelings.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved