vb.net

.NET UserControl's MouseLeave strange behavior

I have a userControl (.NET 1.1 Winforms) that has a clickable picturebox as a button. Since I have lots of those usercontrols visible at the same time, I thought It could be nice if I just display the picture box when the mouse is over the usercontrol and hide it otherwise. To do so, I handle the MouseEnter and MouseLeave events of th...

How to replace xml content in conditionally selected elements using linq (VB 2008)

I'm working on a .NET application (VB 2008) that gets all of its data from a web-based Django application. I'm using Linq-to-XML and Linq-to-objects in the app. One API call is giving me XML data in the following format that I am loading into an XDocument. <django-objects version="1.0"> <object pk="1" model="app.person"> <...

Does VB.NET have anonymous functions?

From what I can find on google, VB.NET only has one-statement lambdas, and not multi-statement anonymous functions. However, all the articles I read were talking about old versions of VB.NET, I couldn't find anything more recent than vs2008 beta 1 or 2. So the question: How can I do this in VB.NET? C# code: private void HandleErrors( ...

.NET --- Textbox control - wait till user is done typing

Greetings all, Is there a built in way to know when a user is done typing into a textbox? (Before hitting tab, Or moving the mouse) I have a database query that occurs on the textchanged event and everything works perfectly. However, I noticed that there is a bit of lag of course because if a user is quickly typing into the textbox th...

Inspecting a Word mail merge data source programmatically

I want to iterate over all rows of a MS-Word mail merge data source and extract the relevant data into an XML. I'm currently using this code: Imports Microsoft.Office.Interop Do objXW.WriteStartElement("Recipient") Dim objDataFields As Word.MailMergeDataFields = DataSource.DataFields For Each FieldIndex As Integer In mdictMergeFi...

LINQ statement where result count is used in expression's condition

O' LINQ-fu masters, please help. I have a requirement where I have to add items into a List(Of T) (let's call it Target) from an IEnumerable(Of T) (let's call it Source) using Target.AddRange() in VB.NET. Target.AddRange(Source.TakeWhie(Function(X, Index) ?)) The ? part is a tricky condition that is something like: As long as the as ...

How to remove one item from string in a textbox

I have a gridview with 2 columns. First field contains checkbox named chkSelect and second column is a label which is binded with EmailId. <asp:GridView ID="gvwNewsLetter" runat="server" AutoGenerateColumns="false" DataKeyNames="UserID"> <Columns> <asp:TemplateField HeaderText="Select"> <ItemTemplate> <asp:CheckBox ID="chkSele...

Variable\Property naming convention

When im naming a variable for a directory should i end the variable name with path, folder or directory. Im writing my code in .net.. ...

Can I change properties of inherited controls at design time?

I am using visual inheritance and was wondering if there is a way to change the properties of inherited controls at design time, preferably in the form designer. If not, then in the designer code. I have my control declared as Public in the base class. I can access it in the child form code, but not in the form designer. Is this just no...

maximum record count for a datagrid in vb.net

what is the maximum record count for a datagrid in vb.net? is there any limit? ...

VB.NET Array Intersection

This could be terribly trivial, but I'm having trouble finding an answer that executes in less than n^2 time. Let's say I have two string arrays and I want to know which strings exist in both arrays. How would I do that, efficiently, in VB.NET or is there a way to do this other than a double loop? ...

FxCop is it as valuable on VB.NET as it is on C#

I have been looking at a few of our VB.NET dll's using FxCop and all of the errors relate to DLL setup (i.e. Strong Names, Culture Info) and the case of Variables methods. Looking at a few examples of FxCop examining a C# Dll, it appears to offer a lot more potential errors. Does this mean that FxCop is more valuable on C# developmen...

How to convert 1400-1500 to 2pm - 3pm?

I am receiving data representing a time slot from a service as a string in the form of: 1500-1600 This meaning 3pm to 4pm. I will have a list of these e.g. 1200-1300 1300-1400 1400-1500 and I have to represent this in the UI as 12pm - 1pm 1pm - 2pm 2pm - 3pm Unfortunately this list could be in a ran...

Regular Expression is missing empty values?

Dim re As New Regex("((?<field>[^"",\r\n]+)|""(?<field>([^""]|"""")+)"")((?<rowbreak>,\r\n|\r\n|\n|$)|,)") 3700,Collin,Franc,,[email protected],Collins,Francine,,[email protected],"Enel North America, Inc.",One T Drive,Suite 220,MyCity,MA,77774,1,[email protected],,,,,3700, 3701,Steur,Larry,,[email protected],Steur,Larry,,[email protected],...

How can I access a class variable via an array in VB.NET?

If I have the following class and declaration: Public Class objLocation Public SysLocationId As String Public NameFull As String Public LatRaw As String Public LongRaw As String Public Active As Integer End Class dim lLocation as new objLocation I can access each variable thus lLocation.SysLocationId, etc. Is there an ...

Bind repeater to DirectoryInfo.GetFiles

Hi If I want to bind the files of a folder to a gridview, I can just do this: GridView1.DataSource = New DirectoryInfo("C:\MyPix").GetFiles GridView1.DataBind() ...And this asp.net <asp:GridView ID="GridView1" runat="server"> <Columns> <asp:BoundField DataField="Name" /> </Columns> </asp:GridView> ...But if I want to bind it t...

Visual Basic Power Packs problem!

Hi all, I include the power packs in my app, and now I encounter problems when I try to deploy it to some other Win-XP machines which do not have Visual Studio (2008), although I include its DLL inside the installation package. The DLL is "C:\Program Files\Common Files\Microsoft Shared\Visual Basic Power Packs\1.1\Microsoft.VisualBasic...

Restoring a database using vb.net

Can anyone help me how to restore a database from vb.net,I tried to restore using stored procedure by taking retore template script from sql server2005. but there is error "the database is already in use please use a master database.." ...

Limit the size of List(Of T) - VB.NET

Hello I am trying to limit the size of my generic list so that after it contains a certain amount of values it wont add any more. I am trying to do this using the Capacity property of the List object but this does not seem to work. Dim slotDates As New List(Of Date) slotDates.Capacity = 7 How would people advice limi...

WPF starting animation from vb.net code giving error

I'm trying to trigger an animation declared in the window's XAML file from the window's vb code when an event is raised (calling a function), like a window's "loaded" event. Here's how I declare the animation (as a storyboard): Dim StartAnimation As Storyboard = DirectCast(FindName("ServiceOn"), Storyboard) Dim StopAnimation As Storybo...