vb.net

.net ToString() format documentation

I saw a code snippet the other day that converts a Boolean value to the corresponding "Yes"/"No" value: CDbl(True).ToString("Yes;Yes;No") The code works fine but I'm curious how it works and I haven't been able to find the answer in the MSDN documentation for ToString(). Can anybody shed some light on this? ...

Databound drop down list - initial value.

How do I set the initial value of a databound drop down list in ASP.NET? For instance, I want the values, but the first value to display should be -- Select One ---, with a null value. ...

DataGridView Autogeneratecolumns as TextBox instead of label

How can I have a datagridview that will autogenerate a textbox instead of a label? ...

VB.Net Interface Visual Studio 2008 font color settings

Is it possible to change the color of the font that Interface Names appear in using VB.Net and Resharper/VS2008? I have been successful changing the interface Names in C# but no luck with VB :( ...

Is it Possible to Force Properties Generated by Entity Framework to implement Interfaces?

Example Interface: public Interface IEntity Property ID() as Integer end Interface I want all my EF objects to implement this interface on there Primary Keys. Is this possible? ...

What are the differences between C#.net and Visual Basic.net?

I have a small experience in VB.net and I would like to learn C#.net What are the differences between VB.net and C#.net? Is there any difference in performance between these two? Apart from the syntactical differences, are there any major changes that I have to keep in mind? Thanks in advance, ...

.Net- should I use the Split-function or the split-method?

Background: I needed to split a string of numerous words into an array which separates the words for me for further use later on in my code. However, I needed to get rid of any numbers which might be present in the string so I declared a string contaning characters which I wanted to use as separators/delimiters as follows: dim Separato...

Windows API and .net languages

People always advised me that if I am doing some application that should use some Windows APIs to do any process level job, I must use VC++ and not any other .net language. Is there any truth in that? Can everything that can be done using VC++ be done in other .net languages also? Are all the .net languages the same when their capabil...

Is it possible to write malware that runs on .NET?

I've heard of security features in the framework and the BCL, but does this have anything to do with preventing malicious programmers from writing harmful software, or preventing malware from running on the CLR? For example, is it possible to write a program in C# that makes harmful changes to the Windows folder? ...

"Domain Users" group is empty when I use DirectoryServices "member" property

I'm using the following code to get the members of a group on my domain: Dim de As New DirectoryEntry("LDAP://" & GroupDN) For Each user As String In CType(de.Properties("member"), IEnumerable) GroupCollection.Add(Username, Username) Next My problem is that when GroupDN (the distinguishedname of the group) is "CN=Do...

Best way to allow the User to define a Table’s Order?

Best way to allow the User to define a Table’s Order? We are using SQL Server 2005 and DevExpress controls. We have a table that contains the following: Process A Process B Process C Report A Report B Report C We want to allow the user to change the order to anything they want. Here is one example: Process C Process A Proce...

Visual Studio Tools for Office 2008 - using a ribbon button to interact with active document

I've created my own ribbon toolbar tab with a few buttons. I can add text and similar actions to the document I'm working on. Now I want to add a button that will save the document I'm working on without using the Word save button because I want to set some of the parameters. Every example I found showed how to save a document that was...

Common causes of - Access Violation errors under .NET

I'm looking for common causes of Access Violation errors under .NET. Things I have checked so far - Call Dispose on all objects implementing IDisposable Check for valid arguments in calls to COM objects Explicitly remove all manually added event handlers DO NOT explicity call GC.Collect/GC.WaitForPendingFinalizers Add and Remove memor...

VB.NET Custom Control (custom drawing) Refresh Problem

Hi, i've created a simple solution with 2 projects. The 1st project (class library) contains a custom control called Container which draws itself with rounded corners. The 2nd project (windows forms) is a test application. If I add a Container instance to main Form in the 2nd project it shows the rounded corners nicely. Also when I run...

Controls on an MDI parent background

Is it a good idea to place controls on the background of an MID parent window? I've added a split container to the MDI window which displays as expected however when I try to open any other forms in the same window they show BEHIND the SplitContainer. The only way to get them to popup is if I use ShowDialog to display them. Unfortunately...

What does the "New ... With" syntax do in VB Linq?

What (if any) is the difference between the results of the following two versions of this VB Linq query? ' assume we have an XElement containing employee details defined somewhere else Dim ee = From e In someXML.<Employee> _ Select New With {.Surname = e.<Surname>, .Forename = e.<Forename>} and Dim ee = From e In someXML.<Employee> ...

VB.NET Tracing Variables

I'm working on an approach to trace logging for my company's VB.NET project. The .NET framework has pretty versatile trace capabilities and I'd like to use what .NET already provides. My company wants to stay away from 3rd party software, so log4net and whatnot is out of the question. They want to be able to trace the flow of the web ...

Extra line breaks in this message were removed

I'm creating a big string that ends up getting sent out via email. The string is created as follows: For Each NewClaim As BO.ClaimsByPECLogIDRO In NewClaims strNewClaims &= Environment.NewLine & NewClaim.ClaimPrefix.ToString _ & "-" & NewClaim.ClaimNumber.ToString & " - " & NewClaim.ReportDate.To...

When to use StringBuilder?

I just revisited some of the books that I used to pick up VB.NET. I am not sure I've got this in my head, understand how/what StringBuilder is. What is the guidance for using? Is it best to use it if you are are concatenating 2 strings or 50? Or when the the total string length is greater than 128 characters? Or will you see a perfor...

"new DirectoryEntry(distinguishedName as string)" doesn't work when DN contains a "/"

I have the following code to convert a distinguishedName to a sAMAccountName: Dim de As New DirectoryEntry("LDAP://" & stringDN) Return CType(de.Properties("samaccountname")(0), String) It works great for every DN I pass it, except for one. We have an AD group on our domain that has a "/" in it - call it "Programmers/DBAs". The DN for...