Wednesday, 24 June 2009
|
| Problem with Ienumerable<T> Trey Nash 13:25:14 |
| | Can someone shed any light on why this code will not compile? The compiler pitches a CS0305 error. This is very frustrating indeed. The problem seems to be with the IEnumerable.GetEnumerator() method and may be related to the controversial decision my the Whidbey folks to derive IEnumerable<T> from IEnumerable.
Thanks,
-Trey
------------------------------------- using System; using System.Collections.Generic;
public class MyContainer<T> : IEnumerable<T> { public void Add( T item ) { impl.Add( item ); }
public void Add<R>( MyContainer<R> otherContainer ) { foreach( item R in otherContainer ) { impl.Add( item ); } }
public IEnumerator<T> GetEnumerator() { foreach( item T in impl ) { yield return item; } }
IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); }
private List<T> impl; }
public class EntryPoint { static void Main() { MyContainer<long> lContainer = new MyContainer<long>(); MyContainer<int> iContainer = new MyContainer<int>();
lContainer.Add( 1 ); lContainer.Add( 2 ); iContainer.Add( 3 ); iContainer.Add( 4 );
lContainer.Add( iContainer );
foreach( long l in lContainer ) { Console.WriteLine( l ); } } }
=================================== This list is hosted by DevelopMentor http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com
|
| | 3 answer | Add comment |
Thursday, 18 June 2009
|
| SqlDateTime.Parse not culture sensitive? Mark Griffiths 10:30:17 |
| | The SqlDateTime.Parse() method does not seem to be honouring the current culture. I am in the UK and have checked that System.Globalization.CultureInfo.CurrentCulture is set to "en-GB". I'm sure everyone knows that in the UK we usually format our dates as dd/MM/yyyy. From the immediate window:
?DateTime.Parse("1/2/2002").ToString("dd-MMM-yyyy") "01-Feb-2002"
?SqlDateTime.Parse("1/2/2002").Value.ToString("dd-MMM-yyyy") "02-Jan-2002"
DateTime.Parse works as expected, but SqlDateTime assumes a US format when parsing the string.
Can anybody confirm this as a bug? or am I doing something wrong?
Mark
You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.
|
| | 3 answer | Add comment |
Tuesday, 9 June 2009
|
| Request.Browser Mark Kucera 07:14:30 |
| | Has anyone had any luck w/ using Request.Browser in ASP.NET 2.0? Specifically the Request.Browser.ScreenPixelsHeight, Request.Browser.ScreenPixelsWidth don't seem to return correct results. When I check these values they just report 640x480 which is not my current resolution (1600x1200). I tried it in FireFox and IE so it doesn't appear to be a browser issue. Is there anything I can do to make these properties return correct values? I tried to google for this info, but surprisingly there isn't much out there...
Thanks for any insight you can provide. MK
=================================== This list is hosted by DevelopMentor http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com
|
| | 4 answer | Add comment |
Monday, 11 May 2009
|
| RichTextBox - autoscrolling Vince P 20:40:37 |
| | C#2.0 I'm sure this was asked before but I wasn't able to find anything. --- How to automatically scroll through the text in a RichTextBox when the lines of text go beyond the lower border of the control (like when adding new lines of text in a "status window" type operation) I know I can set SelectionStart to the end, or ScrollToCaret but these methods/properties require the RichTextBox have the focus.
In this case, my richtextbox is read-only, so the user would never normally put the focus in there, plus the operation that is putting the new lines of text in there takes many minutes to run, so it's not acceptable to keep the focus in there anyway. I tried this richTrace.Text = richTrace.Text + addText + Environment.NewLine;
// richTrace.Focus();
richTrace.SelectionStart = richTrace.TextLength - 1;
When richTrace.Focus() is not commented out, the form steals the focus from whatever other form the user might in at that moment. When it's commented out, the lines of text get appened into the RichTextBox but the text is not scrolled. Is there a solution to this? -------------------- "All left-wing parties in the highly industrialised countries are at bottom a sham" - George Orwell "Rudyard Kipling" (1942)
|
| | 6 answers | Add comment |
Sunday, 3 May 2009
|
| Directory Ops Behaving Asynchronous Brady Kelly 02:50:00 |
| | I have the following code execute:
if (Directory.Exists(exportFolder))
{
Directory.Delete(exportFolder, true);
}
Directory.CreateDirectory(exportFolder);
and then a database update, and then:
wiz57.PerformExport();
Occassionally, about 1 in 20 tests I run in the IDE, PerformExport fails because exportFolder does not exist. How can it not exist if I create it and no exception is thrown? I can only suspect that the Directory code is not truly synchronous, and has not completed before PerformExport executes.
Brady Kelly Software Developer
Chase Software Office: 011 287 1820 Cell: 078 331 3781 Fax: 086 691 5653
<http://www.chasesoftware.co.za/> www.ChaseSoftware.co.za
=================================== This list is hosted by DevelopMentor http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com
|
| | 29 answers | Add comment |
Tuesday, 21 April 2009
|
| Getting to know the ListView VirtualMode Richard Kucia 11:34:47 |
| | I need a little assistance to get past a couple of problems with the ListView in VirtualMode. I understand the basics of setting up a VirtualMode ListView.
1) My app has a ComboBox and a ListView. The ComboBox determines what kind of data is shown in the ListView. When the user changes the ComboBox, how can code inform the ListView that all the visible items need to be refetched (because the content is being replaced)?
2) How can code select a virtual item in the ListView?
Thanks. Richard Kucia
|
| | 7 answers | Add comment |
Thursday, 16 April 2009
|
| convert XDW to PDF Guest 03:54:55 |
| | I'm trying to convert a xdw file to a pdf file with vb.net. i could convert jpeg or bmp files to a pdf file with iText, but i can't find a way to convert xdw to pdf. iText may not support xdw,i think. Is it possible to make it? |
| | Add comment |
Saturday, 4 April 2009
|
| Random number generation. Vijay M 08:05:26 |
| | Hi all,
I am trying to create a monte carlo code for some computational work in predicting the path of photons ! I have worked on .NET for the past two years but havent really pushed the random number generator to know a lot about it.
A successful monte carlo code depends on a true random number generator and the efficieny of the generator is prime. I tried searching to determine any benchmarks as to whether the .NET Random object is truly random ! But there aren't that many articles in the net about it ( Maybe i was just blind ?! Feel free to throw some good links if you find )
I could have used Fortran to do it because for ages, people have been using Fortran to do Monte carlo code and it has been reliable. But i want to try it in .NET and hoped to settle this matter soon. If anyone has worked on cryptographic applications or monte carlo codes which depend solely on random numbers, help me out !
All right. All the ramble apart, the question is whether .NET can be used to create a successful Monte carlo code ?! If yes, then which class, System.Random or the System.Security.Cryptography.RandomNumberGenerator, do i use to get better results ? Also, i am planning to implement the algorithm as a multithreaded app. The online help specifies that both the classes are thread safe is declared static but instance variables are not ! Are there any issues in doing so ? Are there any best practices that can be followed while using Random numbers in a multithreaded app ??
These are some of the question that have stalled my work for now. Throw in your advice from experience. Would be glad to hear 'em ! Thanks.
Vijay
=================================== This list is hosted by DevelopMentor® http://www.develop.com Some .NET courses you may be interested in:
Essential .NET: building applications and components with C# November 29 - December 3, in Los Angeles http://www.develop.com/courses/edotnet
View archives and manage your subscription(s) at http://discuss.develop.com
|
| | 39 answers | Add comment |
Wednesday, 25 March 2009
|
| Re: vb.Net treeview control (New problem) Robert N. Harris 08:08:03 |
| | Thanks Greg, Jacob, Ian, and Walter for all the great advice. I wound up using a hashtable to store node references and it worked great. I've got heirarchical information in a datatable. It is essentially a directory structure, representing the folders in an Outlook mailbox. The treeview is supposed to display the folder heirarchy just as it would appear in Outlook. I have two dataviews on the datatable, one just to iterate through all the records, the second to look for the parent record of subordinate folders. Here is the basic code (lots of stuff omitted for clarity):
For Each drv In dv 'Iterating through all the folders recorded in the datatable's default view
If drv("ParentPath") = "" Then 'this will be a root node 'Create the node nod = New TreeNode nod.Text = drv("Path")
'Store the node in the hashtable to retrieve it later, retrieving by the database id htNodes.Add(drv("ID"), nod)
'Add the node to the root of the tree tvwFolders.Nodes.Add(nod)
else 'This is a subordinate node
'Find the parent folder in the data table through the second dataview intParentIndex = dvParents.Find(drv("ParentPath")) intParentID = dvParents(intParentIndex)("ID") 'Gets the database ID of the parent folder
'Retrieve the parent node from the hashtable nodParent = htNodes.Item(intParentID)
'Create the node nod = New TreeNode nod.Text = drv("Path")
'Add the new node to the parent node nodParent.Nodes.Add(nod)
'Store the child node in the hashtable to retrieve it later in case it has childern, too htNodes.Add(drv("ID"), nod) end if
Next drv
This results in the desired treeview, and in a new problem. Now i am getting strange exceptions on the line of code that makes the form visible. Here's the code that instantiates the form with the treeview:
fmReview = New frmReview fmReview.MdiParent = Me fmReview.GetBin(strBinNo) 'This is the code that loads the treeview Try fmReview.Show() Catch 'Stop End Try
On fmReview.Show(), I get the following exception: "An unhandled exception of type 'System.OutOfMemoryException' occurred in system.windows.forms.dll
Additional information: Error creating window handle."
I stop execution in the catch block and check fmReview's properties. It is visible, and it has a handle. If I just let the code resume and do nothing, the program executes normally. What is causing this error? It doesn;t seem to be affecting anything...
Thanks again!
Robert Harris
-----Original Message----- From: Discussion forum for developers using Windows Forms to build apps and controls [mailto OTNET-WINFORMS@DISCUSS.DEVELOP.COM]On Behalf Of Robert N. Harris Sent: Friday, January 07, 2005 11:32 AM To: DOTNET-WINFORMS@DISCUSS.DEVELOP.COM Subject: [DOTNET-WINFORMS] vb.Net treeview control
Hello group! I'm new to this group and only slightly less new to .Net programming. My background is as a Microsoft Access developer, with moderate experience in SQL Server and Visual Basic 6. I am currently rewriting one of our Access applications in VB.Net, and I'm noticing some subtle differences in the way certain .Net controls behave compared to their old VB counterparts. I'm hoping someone here can help me out.
The Treeview control, and specifically the Index property of TreeNode objects contained in the Treeview. In old VB, the index of a given node was unique throught the entire treeview control. The index number of a node was assigned sequentially as you added nodes, and could not repeat.
In .Net, it appears that the scope of the TreeNode index has changed, so that it is only unique within the node it was added to. So, there can be any number of nodes in the Treeview with an index of "0", "1", or whatever number.
This is causing me trouble because I need to add child nodes at runtime. I need to know how to uniquely identify a node in the tree, reference it, and add nodes to it. In old VB the Index or Key property would accomplish this. Well, the TreeView lost the Key property in .Net, so I'm stuck.
Any ideas or advice is greatly appreciated.
Thank you!
Robert Harris
|
| | 14 answers | Add comment |
Wednesday, 18 March 2009
|
| Why doesn't DataFormatString="{0:d}" affect the display of datetimes in my GridView BoundColumn? Roy Pardee 15:05:55 |
| | Hey All,
I've got an asp.net 2.0 gridview bound to a mssql view w/a datetime column in it. Here's the def of the column:
<asp:BoundField DataField="OutDate" HeaderText="Survey Date" SortExpression="OutDate" DataFormatString="{0:d}" />
The values don't really have time information, so I only want to display the date portion. From everything I've read, that {0:d} format should have that effect. But I'm still getting values displayed like:
6/15/2006 12:00:00 AM
I have tried these format specs, none of which are having any effect:
"{0:MM-dd-yyyy}" "{m/d/yyyy}"
If I make the format string
"{0:d} booga booga!"
Then the values come out as:
6/15/2006 12:00:00 AM booga booga
So I know I'm tweaking the proper column...
Anybody got a clue for me?
Thanks!
-Roy
=================================== This list is hosted by DevelopMentor http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com
|
| | 5 answers | Add comment |
Thursday, 12 February 2009
|
| REGASM Leaves Type Library Brady Kelly 08:28:33 |
| | When I run REGASM /u on an assembly I register, it tells me "Types un-registered successfully", but using the old OLE/COM Object Viewer, I see the type library is still registered.
=================================== This list is hosted by DevelopMentor http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com
|
| | 4 answer | Add comment |
Tuesday, 27 January 2009
|
| ASP.NET Menu control, dynamic menu link to nowhere Ron Young 13:20:22 |
| | I need to display a dynamic menu that has a structure like so:
Programs - Multi-Family - Projects - Residential - Projects
Where "Multi-Family" is a sub-menu under Programs, and "Projects" is a sub-menu under Multi-Family, and similar for Residential.
I'm using ASP.NET Menu and a sitemap file.
Problem is that I need "Multi-Family" and "Residential" to link to nowhere:
siteMapNode url="Main.aspx" title="Programs" - siteMapNode url="" title="Multi-Family" - siteMapNode url="Main.aspx?view=MultiFamilyProjects" title="Projects" - siteMapNode url="" title="Residential" - siteMapNode url="Main.aspx?view=ResedentialProjects" title="Projects"
Using an empty string for "url" works for me, but the issue is that the "text" cursor will display if the link doesn't have a url.
I tried some CSS but that didn't work:
.dynamicMenutItem{ cursor: pointer; }
Faking the url with "javascript:;" won't work because the each node needs a unique url.
Any info on this is greatly appreciated.
Ron
=================================== This list is hosted by DevelopMentor® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com
|
| | 1 answer | Add comment |
Friday, 9 January 2009
|
| Expiration of your subscription to the DOTNET-WINFORMS list PEACH.EASE.LSOFT.COM LISTSERV Server 14:01:13 |
| | Fri, 9 Jan 2009 06:01:13
Your subscription to the DOTNET-WINFORMS list has expired and you have failed to confirm it in the 14 day delay that you had been granted. Therefore, you have been automatically removed from the list. If you want to re-subscribe to the list, then send the following command to LISTSERV@PEACH.EASE.LSOFT.COM:
SUBscribe DOTNET-WINFORMS
|
| | Add comment |
Wednesday, 7 January 2009
|
| ServiceController status returning wrong state? Blain T Timberlake 19:45:54 |
| | This is a repost from CLR, doesn't seem like there is much activity over on that list. This isn't really all too advanced though, so I apologize in advance. ;)
Using the system.ServiceProcess.ServiceController I'm getting some odd values back.
Basically if I pull up a list of services on a remote machine, there are several services that consistently report the wrong status back. Some others however report correctly.
For instance.... I do:
If myService.Status <> ServiceControllerStatus.Running Then Throw New Exception("Service was not running") End If
If I run that for the service "Server", which is running, it throws an exception.
If I run for "Alerter" it reports correctly that it is running.
Checking "Computer Browser" also throws an exception even though it too is running.
Anyone know of any rhyme or reason for what is going on here? On the remote machine I am a full administrator. Just using the Services MSC console I can pull up the list of all the services on the remote machine and view statuses and/or start and stop them just fine.
Any thoughts? =Blain
This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties.
Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean
http://www.DuPont.com/corp/email_disclaimer.html
=================================== This list is hosted by DevelopMentor http://www.develop.com Some .NET courses you may be interested in:
Essential .NET: building applications and components with CSharp August 30 - September 3, in Los Angeles http://www.develop.com/courses/edotnet
View archives and manage your subscription(s) at http://discuss.develop.com
|
| | 5 answers | Add comment |
Friday, 2 January 2009
|
| Expiration of your subscription to the DOTNET-WEB list PEACH.EASE.LSOFT.COM LISTSERV Server 14:00:22 |
| | Fri, 2 Jan 2009 06:00:22
Your subscription to the DOTNET-WEB list has expired and you have failed to confirm it in the 14 day delay that you had been granted. Therefore, you have been automatically removed from the list. If you want to re-subscribe to the list, then send the following command to LISTSERV@PEACH.EASE.LSOFT.COM:
SUBscribe DOTNET-WEB
|
| | Add comment |
Friday, 26 December 2008
|
| Renewal of your subscription to the DOTNET-WINFORMS list PEACH.EASE.LSOFT.COM LISTSERV Server 14:00:52 |
| | Fri, 26 Dec 2008 06:00:52
Your subscription to the DOTNET-WINFORMS list is due for renewal. If you wish to remain subscribed to DOTNET-WINFORMS, please issue the following command to LISTSERV@PEACH.EASE.LSOFT.COM at your earliest convenience:
CONFIRM DOTNET-WINFORMS
You will be automatically removed from the list if you do not send a CONFIRM command within the next 14 days. The simplest way to do this is to click on the following link:
http://peach.ease.lsoft.com/scripts/wa.exe?LCMD=CONFIRM+DOTNET-WINFORMS&L=DOTNET-WINFORMS
|
| | Add comment |
Friday, 19 December 2008
|
| Renewal of your subscription to the DOTNET-WEB list PEACH.EASE.LSOFT.COM LISTSERV Server 14:00:23 |
| | Fri, 19 Dec 2008 06:00:23
Your subscription to the DOTNET-WEB list is due for renewal. If you wish to remain subscribed to DOTNET-WEB, please issue the following command to LISTSERV@PEACH.EASE.LSOFT.COM at your earliest convenience:
CONFIRM DOTNET-WEB
You will be automatically removed from the list if you do not send a CONFIRM command within the next 14 days. The simplest way to do this is to click on the following link:
http://peach.ease.lsoft.com/scripts/wa.exe?LCMD=CONFIRM+DOTNET-WEB&L=DOTNET-WEB
|
| | Add comment |
Friday, 12 December 2008
|
i need a project on employee reposi... ranji 12:04:52 |
| | i need a project on employee repository portal using c# and asp.net
|
| | Add comment |
|
| how to disable image saving in dotn... Guest 11:58:24 |
| | how to disable image saving in dotnet using c# n asp.net |
| | Add comment |
Monday, 1 December 2008
|
| Expiration of your subscription to the DOTNET-CLR list L-Soft list server at DevelopMentor 10:26:17 |
| | Thu, 18 Sep 2008 06:00:05
Your subscription to the DOTNET-CLR list has expired and you have failed to confirm it in the 14 day delay that you had been granted. You have therefore been automatically removed from the list. You can re-subscribe to the list, if you want to, by sending the following command to LISTSERV@DISCUSS.DEVELOP.COM:
SUBscribe DOTNET-CLR
|
| | 1 answer | Add comment |
Tuesday, 18 November 2008
|
| Trying to trap a "first chance exception" Lee P. Gray 02:08:59 |
| | I keep getting a somewhat random first chance exception when filling a DataTable:
"A first chance exception of type 'System.IndexOutOfRangeException' occurred in system.windows.forms.dll"
Sometimes it happens on the first fill, and sometimes it takes several.
I've wrapped the DataAdapter.Fill() statement in try/catch block, and I've set the IDE to "Break into the debugger" for that exception, but I can't figure out how to view any more details about the exception to troubleshoot any further.
When the debugger kicks in, it's on the .Fill() statement, but when I step through it, the catch block doesn't catch the exception. Does that mean it's getting caught in the DataAdapter's internals?
Any suggestions?
Thanks, Lee
|
| | 9 answers | Add comment |
Wednesday, 12 November 2008
|
| Re: Filter what the FolderBrowserDialog shows? Peter Ritchie 06:15:24 |
| | FolderBrowserDialog is a wrapper for SHBrowseForFolder which does support custom filtering; but FolderBrowserDialog doesn't implement that particular feature. You'd have to re-write FolderBrowserDialog to do what you want. Even if it wasn't sealed you'd have to re-write most of code (RunDialog override and the callback method) anyway.
http://msdn2.microsoft.com/en-us/library/ms647664.aspx describes the detail of FolderBrowseDialog and the use of the IFilterSite interface to do the custom filtering. Arik Poznanski wrote a series of articles on shell programming in C# that included a bit of detail on custom filters in the first of the series: http://www.codeproject.com/csharp/csdoesshell1.asp.
HTH
On Mon, 27 Aug 2007 14:11:03 -0600, Bhatnagar, Amit <Amit.Bhatnagar@GDCANADA.COM> wrote:
Using the FolderBrowserDialog, is there a way to filter what directories that it shows? For example, say I only want the user to pic folders that end in the word "Mail" or something. If the FolderBrowserDialog doesn't support this, would I have to create a custom folder picker and filter the list manually?
|
| | 1 answer | Add comment |
Monday, 10 November 2008
|
| LINUX AND C# Guest 15:57:54 |
| | Does anyone have an idea hot to make c# work on linux if so could u give me detailed explanation coz I don’t know linux but my project is done in c# and linux please mail to me at ammaps_dev@zyberops.com Thanking u in adavance
|
| | 2 answer | Add comment |
Tuesday, 4 November 2008
|
| Server.Transfer Brandon Manchester 10:36:24 |
| | Can someone please explain why I get a parse error when using Server.Transfer if I do not include the assembly of the web app that I'm transferring to in the bin directory of the calling web app?
Both apps are running on the same server so I would think that I would be able to do a Server.Transfer between the two. Maybe I don't fully grok the use of Server.Transfer. What I'm trying to do is keep the Session state alive between two separate web apps and I was under the impression that the only way to do this is via Server.Transfer. Maybe I'm going about this all wrong.
Any help would be appreciated.
Thanks, B.
Brandon D. Manchester Software Developer Financial Brokerage 2238 South 156 Circle Omaha, NE 68130 ph (402)778-4999 http://www.fb-inc.com <http://www.fb-inc.com/>
Notice of Confidentiality: This transmission is intended only for the use of the individual or entity named above. It may contain information that is privileged, confidential, and/or exempt from disclosure under applicable law. Further, disclosure of this information may be specifically prohibited under state or Federal law. If you are not the intended recipient, or the employee or agent of the recipient responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is strictly prohibited. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format.
=================================== This list is hosted by DevelopMentor® http://www.develop.com NEW! ASP.NET courses you may be interested in:
Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls
View archives and manage your subscription(s) at http://discuss.develop.com
|
| | 18 answers | Add comment |
|