vb.net

C# to VB .NET yield return conversion

Hello, What's the translation of this snippet in VB .NET? public static IEnumerable<TSource> Where<TSource>( this IEnumerable<TSource> source, Func<TSource, Boolean> predicate) { foreach (TSource element in source) { if (predicate(element)) yield return element; } } ...

Problem adding Crystal Report to VS 2005 project

I'm trying to add a Crystal Report to a VS 2005 VB project. Here's what I do: Right-click on my project, Add -> New Item ... Crystal Report Add a report with the standard report wizard (or just a blank report I get this error: 'Site' is not a member of 'MyProject.CachedCrystalReport1' C:\BasProj\MyProject\MyProject\CrystalRepo...

VB.net can't find by string

Using VB.net, the following snippet gives the error below. Dim _account = Account.Find(Function(x As Account) x.AccountName = txtFilterAccountName.Text) or similarly if I do .SingleOrDefault (Function(x As Account) x.AccountName = txtFilterAccountName.Text) will both give the error "The method 'CompareString' is not supported". I...

Visual Studio 2008 crashes when opening solutions in a TortiseSVN directory? How do I fix this?

I'm using TortiseSVN for my subversion client on a Windows Server 2008 box and I've got a folder with code checked out into it. When I go to open the solution file that's under source control Visual Studio 2008 starts and before it can even finish loading the solution from what I can tell Visual Studio crashes. I'm trying to open a sol...

When Using FormView with Templates, Is It Possible to Reference Controls Statically?

Having: <asp:FormView ID="frmEmployee" runat="server"> <EditTemplate> <asp:TextBox ID="txtFirstName" runat="server" /> </EditTemplate> </asp:FormView> one uses FindControl to reference the txtFirstName textbox in the code-behind file: VB.Net Dim txtFirstName As TextBox = CType(Page.FindControl("txtFirstName"), TextBox...

VB.NET Pocket PC Database connection

Hi, I have created a database using SQlServer CE with the name of db.sdf using the following code. Dim connStr As String = "Data Source =\temp\emp.sdf;" Try 'creating database Dim engine As SqlCeEngine engine = New SqlCeEngine(connStr) engine.CreateDatabase() engine.Dispose() ...

(.net) Kind of design question

Hello. My typical application has a couple of textboxes, checkbuttons, radiobuttons, and so. I always want to load the settings the user used the last time when the program starts, and also want to save the settings as the users clicks "Save settings" or closes the application. When the user attempts to save the settings, I'll have to c...

replace system color in windows backgrounds

the following code is supposed to replace the system color that's used for window backgrounds. You'd change it by P/Invoking the SetSysColor() API function. i am using the following code that was suggested to me but unfortunately when i click the button nothing happens! Imports System Imports System.Drawing Imports System.Windows.Forms ...

GC.AddMemoryPressure question

I've read about it on msdn and on CLR via c#. My main question about it is the following: let's imagine we have a 2Mb unmanaged HBITMAP allocated and a 8 bytes managed bitmap pointing to it. What's the point of telling the GC about it with AddMemoryPressure if it is never going to be able to make anything about the object, as it is allo...

GC.Collect()

Ok, I've read a couple of topics about it, but here it goes. Let's imagine I have an application where basically every now and then I will click on a button, a lot of things will happen for a couple of minutes, and then it'll stay idle possible for another hour, or maybe just 1 minute. Wouldn't just after that whole ended a good situatio...

VB.NET API Delegates , Events ??? HELP Please

Hi All, I am stuck trying to work out Events and Delegates. I am trying to hook up to an external API which return events when certain events occur. The original code was written in C#, and I am trying to do this in VB.net Here is a short comment from the API programmers. "After that, client app should need to wait for one of events: ...

how i clear all data in datagridview and it would not effect in delete data - vb.net

hihi, how i clear all data and not delete data or column in datagridview? i wan clear the data first and query on the result to make the result not duplicate.. can anyone help me?? ...

Can I change the text of a label in a masterpage when loading a content page?

I have a label in a master page (sample.master) called lblHeading. I want to dynamically change the text of the label when I load the content page. I need to do this because I want to change the heading to something meaningful but only after I know about the content of the page. Is this possible? ...

How do I write Visual Basic Code to read the input from a barcode scanner?

I want to write software in visual basic that reads the barcode of various items into my program. Any suggestions for how to do this? ...

ClientID problem when trying to override a control's Render event

I'm using ASP.Net 2.0. I have a custom control that is inherits from a 3rd-party vendor's control. I'm trying to override the Render method. Protected Overrides Sub Render(ByVal writer As HtmlTextWriter) if (some condition is true) then Dim d As New Button() d.RenderControl(writer) else MyBase.Render(writer) ...

How would you write Gorillas in .NET?

I remember a QuickBasic program (named Gorillas) where there was a monkey who would toss a banana, I believe at another monkey. I want to write this in .NET to learn some. How would I get started doing that? ...

Is it possible to read .eml files in .net

I would like to know if it is possible to parse .eml and .msg files in dot net (preferably from a memorystream) such that I can use them on an ASP.Net page. ...

VB .NET: Logged in user information

Hi everyone, I'm writing software in VB .NET (2005) which uses the Windows user information as login credentials - just the username. I've found Environment.UserName which works for the username (as you would expect). However, I need more information - I need the full name of the user (as shown on the Start Menu). It seems this informa...

How to lock down a running application

I have a little applet that controls requests from the scanner... Its a canon applet, not opensource. Question is: Does anyone know of a program that can lock access to running programs or could point me in the the direction of examples where i could write a small applet myself.. I have looked on google but all programs available such ...

DIsplaying images in vb.net

Hi I am using visual studio 8, vb.net. I have a picture box on my form, picturebox1 I have a number of image files name image1.gif image2.gif image3.gif etc upto image52.gif I want to display an image in a picturebox dependant upon a value wich is generated elsewhere in the app, so that if '3' is generated I a picturebox to display ima...