Hi all. Im having a problem with losing data in a class but im unsure as to exactly how its happening. I post here an example of the parts of the code i am using that are causing a problem with an explanation of where i am seeing the problem(s) and hopefully someone will be able to point out what i am doing wrong.
line 1public ndlist as list (of data)
line 2public dylist as list (of days)
line 5publicsub main_routine()
line 7 ndlist = new list (of data)
line 8 dylist = new list (of days)
line 10for a = 1to something
line 13 ndlist.add(new data("blahblah"))
line 14' do something to ndlist
line 16loop until something
line 18 dylist.add(new days(a,b,ndlist))
line 19 ndlist.clear
line 21next a
line 23foreach dy as days in dylist
line 24' do something else
line 31'For reference
line 33publicclass days
line 35public day_data as list(of data)
line 37publicsubnew(byval a asinteger, byval b asinteger,byval ddata as list(of data))
line 39 day_data = ddata
line 45publicclass data
line 47public rwdata(1500)
line 48public id asstring
line 50publicsubnew(byval str asstring)
line 52 id = str
So you can see basically i have a list of days containing a list of data for each day. I use the data class in lists elsewhere in the project and thought it would be easier to re-use it for the day class. What i am seeing is between lines 10 and 21 the program operates normally. If i insert a breakpoint in vs2010 on line 18 i can watch the dylist add items to its collection and when i drill down the elements of the collections i can see the data where i expect it to be. For reference the data is at
The problem comes when i exit the for/next loop for further processing. When i get to line 23 and i access
it contains nothing as do all the the other elements in the dylist collection and i have no idea why?
The code runs all at once and there is no background threads or anything else happening in the background when i run the code. I am firing it off a button just now for testing.
btw - great website! i use this all the time for little snippets of info for my coding but have never had to resort to posting here yet. Thanks for all the help ive utilised from your site so far
I figured it out just now. Seems im actually passing the reference of ndlist to the class contructor so (as you pointed out) when i clear the list i also clear all of the data in all of the instances of the dylist class members. Very confusing
What i actually want to do is initialise the list type for the instance of the class within its contructor and then recursivley add the list members to each class instance separately. Using a "work" list and passing it as a parameter doesnt work
My thinking was that a list would be passed the same way as the values in an array are passed, so you could modify the source list afterwards without affecting your previous destination lists.
Create CSV files via VB.Net and then add these files to 7 zip manager. I want to do this automatically rather than getting the users to manually add these files to 7 zip manager. Before I start doing this....
1. Can this be done
2. If so how and is there any good examples I could use?
I want a simple program using "File Mapping" for communication betrween two processes.............the commncation can be either using dialouge or console communications ............Thank you please help me out its urgent.Am writing code in VB 6.0
Your subject is non-descriptive, not helpful at all.
It's not urgent, we're volunteers.
VB6 is deprecated, it's dead. No new software is written in it, it's no longer sold, it's not supported.
We don't supply programs/complete source code. It's a forum for developers, doing development.
FWIW; there's a FileSystemWatcher in .NET that easy to use, and VB.NET is free to download and use. If one app is launched from the other, I'd suggest using stdio, reading and writing to the console-window. If they're on separate computers, look into WCF.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
I have four textboxes. Each one is filled by selecting a date from the monthcalendar (VS win form). While I handled most of the problems, such as a dbnull, I discovered this little "oops". I use the same type of handle for each daterangeevetargs:
PrivateSub MonthCalendarPO_DateSelected(sender AsObject, e As DateRangeEventArgs) Handles MonthCalendarPO.DateSelected
JobPOdateTextBox.Text = e.Start.ToShortDateString
MonthCalendarPO.Visible = FalseEndSub
A click of a picture box to hide and show the calendar:
PrivateSub PictureBoxPO_Click(sender AsObject, e As EventArgs) Handles PictureBoxPO.Click
If MonthCalendarPO.Visible = FalseThen
MonthCalendarPO.Visible = TrueElse
MonthCalendarPO.Visible = FalseEndIfEndSub
I removed the custom validation too. So, I will not post. The problem exists even without checking the date format.
Each date is filled and visible in a textbox. Yet, when clicking the "save" button, only one date will remain in a textbox and save on submit changes (dates are bound to a bindingsource). As I have read and and read some more, I feel it must be the daterangeeventargs.
Worth noting, if you manually enter the date into the textboxes, all four dates will save on submit changes. For now, I have resolved to a submit changes to the database after each date selection. This is certainly not ideal or a good practice.
Bindingsource is filled as system.linq.iqueryable(of namespace.tablename). Data class is Linq2SQL.
Any ideas on why this type of behavior is experienced?
Thanks again. What would I do without your brain. I was not even looking at the string development in any manner. I should have known that. My languages are a little mixed up some days. Dumb newbie thing ... LOL
In VB6.0 Do you know the name of the control cell grid in the image above there are two lines in the header and the grid can color, see attached image. we can see in the figure, in the title (framed blue rectangle) is the 3rd day 9 was split into two lines and grid can be colored as: red, blue, ... the name of a grid control on the name?
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch