vb.net

Is this a bug (Windows API)?

I had a question about string normalization and it was already answered, but the problem is, I cannot correctly normalize korean characters that require 3 keystrokes With the input "ㅁㅜㄷ"(from keystrokes "ane"), it comes out "무ㄷ" instead of "묻". With the input "ㅌㅐㅇ"(from keystrokes "xod"), it comes out "태ㅇ" instead of "탱". This is Mr. De...

How to Save Data from WinForms Controls to a SQL Server Database?

SO I am just getting started with this. New to .NET, SQL Server, C#, VB.NET, etc and the closest thing I have to related to this is some experience with MS Access and the VBA that relates to that and MS Office automation. So I do have Visual VB.NET 2008 Express installed, SQL Server 2005 express installed, and I do know how to start a b...

GDI+ Moving Line Memory Leak

I have tried to do this both with GDI+/Invalidate and by using a Line Shape Control. In both cases the memory spirals out of control. To demonstrate, create a windows form application with a timer object which is set to 100ms and enabled and use the following code: Public Class Form1 Private Y As Integer Private intDirection As ...

vb.net when i build it is showing 0 errors but when i execute it is raising this error

The type for variable 'cri' will not be inferred because it is bound to a field in an enclosing scope. Either change the name of 'cri', of use the fully qualified name (for example, 'Me.cri' or 'MyBase.cri') I have created a class file with name Predefined which consists of this methods like cricket,BasketBall from this methos im return...

Setting user's password via System.DirectoryServices.Protocols in AD 2008 R2

Hello. I am connecting to a Microsoft Active Directory server in a DMZ from my .net application (asp.net VB .net 4.0). I need to create a new "inetorgperson" in an orgunit called "SingleCustomerAccount". I have had to use the System.DirectoryServices.Protocols namespace for all the work, because the ADSI classes (System.DirectoryServic...

How to retrieve HDD Firmware Serial number in .net?

Hi, How can I retrieve HDD Firmware Serial number in .net? I am able to retrieve HDD Serial number using WMI calls but not able to find any way to retrieve HDD Firmware Serial number. Thanx in advance ...

XML namespace for attributes

Question: I have an xml element + attributes, which all need to be in a namespace. I set the element + all attributes into the namespace oai, and I get: <oai:room building="AB" rmName="001"> but the XML i need to generate should look like this: <oai:room oai:building="AB" oai:rmName="001"> Why does it remove the oai namespace in t...

Container for Constants in VB.NET

VB.NET (.NET 2) Say I have some constants that depends one of other, and I decided to keep them together in a container instead of keeping it as individual constants in a class. I thought use a Structure for that scope, but compiler force me to declare a private member for that structure. ' Compile error: at least one private member...

MVC Music Store tutorial in VB?

Hi, I'm working through the MVC Music Store in Visual Basic (mvcmusicstore.codeplex.com), trying to convert things as I go. I'm heving trouble with some of the lambda expressions in the Views, however. Specifically, on page 53 when the Album editor template is used, I am not seeing my editor template when I use the following code: Orig...

Loop through controls and change LINQ columns

Hi I have the following code: Dim i As Integer For i = 1 To 20 Dim captionTextBox As TextBox = DirectCast(Me.FindControl("news_Image" + i.ToString() + "CaptionTextBox"), TextBox) Dim deleteCheckBox As CheckBox = DirectCast(Me.FindControl("Image" + i.ToString() + "DeleteCheckBox"), CheckBox) If Not deleteChec...

vb.net string of nulls

I have a string value read in from a CSV file. The CSV file contains 7 NULL bytes, I have confirmed this by opening it in a hex editor and sure enought there are 7 0x0 bytes in there. This string is causing me pain. In vb.net when I check the strlen of this string it returns a value of 7 and if i do a String.IsNullOrWhitespace it return...

Stripping all html tags with Html Agility Pack

Hi forum I have a html string like this: <html><body><p>foo <a href='http://www.example.com'&gt;bar&lt;/a&gt; baz</p></body></html> I wish to strip all html tags so that the resulting string becomes: foo bar baz From another post here at SO I've come up with this function (which uses the Html Agility Pack): Public Shared Functi...

What GPS Dongles work with Windows 7 and the .Net 4.0 System.Device.Location Namespace?

Hi, I want to add full GPS support into my application. The .Net 4.0 System.Device.Location namespace information here is perfect for my needs. When this was first announced and the Beta release was out, I got a GPS dongle, but I could never get Windows 7 to see it as a sensor and therefore make use of System.Device.Location. After many...

display ms word doc in browser

How can I get my asp.net webpage to display a word document in the browser? This is a controlled environment where everyone has exactly the same browser settings and everyone uses internet explorer 7. It is an intranet environment. ...

What's the equivalent VB.NET syntax for anonymous types in a LINQ statement?

I'm trying to translate some C# LINQ code into VB.NET and am stuck on how to declare an anonymous type in VB.NET. .Select(ci => new { CartItem = ci, Discount = DiscountItems.FirstOrDefault(di => di.SKU == ci.SKU) }) How do you translate C#'s new { ... } syntax into VB.NET? ...

Nested multi-line lambda Function as parameter for LINQ Select is causing an error

I'm trying to use a nested multi-line lambda Function in VB.NET and am getting an error. Here's what my code looks like: cartItems = cartItems.Select(Function(ci) New With {.CartItem = ci, .Discount = discountItems.FirstOrDefault(Function(di) di.SKU = ci.SKU)}) .Select(Function(k) If k.Discount Is Not Nothing Then ...

Create List of Control Groups in VB.Net?

I'm building an control interface for a system that consists of 1-4 modules. In my interface, each module has its own control set, grouped in a groupbox. I only want to show the control groups for the modules that are actually connected and hide the rest. This is easy to do with the visble property. I also want all of the groups to b...

LINQ - querying top 5 with rank number

How do I return a top 5 with rank number using linq? Dim Top5 = From A In DAO.Cache.Select(Of VO.Empresa).Take(5) Select A.Nome I would like this result: Rank Name 1 "Example Name" 2 "Example Name" 3 "Example Name" 4 "Example Name" 5 "Example Name" ...

Can I add an Outlook Attachment from a PictureBox image?

Hi, I have an image in my VB.NET Picture box. I would like to attach it to the email message I'm sending through Outlook without having to save it to the drive anywhere. Is it possible to do such a thing? Here's what I have so far (taken from here): Public Class email Dim app As Microsoft.Office.Interop.Outlook.Application Dim...

LINQ VB.net Return Single Type of Object Invalid Cast

Ok, just needing a 2nd set of eyes looking at this to make sure the error isn't something else other than my LINQ code here.  Here's the function class itself: Public Function GetJacketByPolicyID(ByVal jacketID As Int32) As tblPolicy Dim db As New DEVDataContext() Dim j As tblPolicy = db.tblPolicies.Single(Function(p) p.policyNumb...