vb.net

VB.NET DataGridView "An item with the same key has already been added." while using a unique index

VB.NET 2010, .NET 4 Hello, I've looked around and can't seem to find a solution to my problem. I have an EventLog object which inherits DataGridView and has a public variable EventList which is a List(Of EventLogItem). EventLogItem has seven properties which describe the event, including Index which is set to EventList.Count each tim...

Casting to List(Of T) in VB.NET

In C# it's possible to cast to List<T> - so if you have: List<Activity> _Activities; List<T> _list; The following will work: _list = _Activities as List<T>; but the translated line with VB.NET which is: _list = TryCast(_Activities, List(Of T)) throws a compilation error. So I've had a good hunt around and experimented with LINQ ...

Allow each item to use multiple lines in a Winforms Combobox (or Listbox)

The title pretty much says it all. Can this be done with relative ease? Thanks! ...

LINQ-to-SQL The EntitySet is already loaded and the source cannot be changed.

I have an app which uses Linq2SQL to retrieve parent/child data. The parent data is stored in a binding source, Me.SampleDataBindingSource, and the child data in Me.MeasurementsBindingSource. When I create a new SampleData entity, the program works fine. But, when I try to retrieve an existing entity, I get the following error: Syst...

Personal meters & tools - C# or VB.Net?

Hello. I'm sure a lot of people around here tried Rainmeter or Google desktop. They are nice but I never felt comfortable using them on my desktop, either because they ate too many space or aren't much flexible in terms of settings and stuff that can be grabbed from the Webs. So I thought I'd make my own personal tools. It's intended f...

Asp.net MVC 2 JqueryGrid table row empty

I need some help with asp.net mvc Controller: <HandleError()> _ Public Class HomeController Inherits System.Web.Mvc.Controller Function Index() As ActionResult ViewData("Message") = "Welcome to ASP.NET MVC!" Return View() End Function Public Function GetMovieData() As ActionResult Dim sortColu...

Unable to manipulate string

In my website i have a script that return the current song that playing from my shoutcast server in a format of: "artist-track", what i want to do is to take that string and split it to 2 strings: artist and track, in order to do that i wrapped the script in server tag like this: <div id="nowPlaying" runat="server"> <script type="tex...

Help with sending text thou TCP/IP or LAN

Hey all i am trying to send a text message from a virtual machine (VMWARE) to my local machine so that i can hit a button in the VM and have it do something on the local. Is there anyway to send a text through an IP, TCP/IP, LAN using VB6 or VB.net? I was looking at the net send to send something but it doesn't seem to work for me (as w...

vb.NET WebRequest to read aspx page to string, access denied?

I'm trying to make an executable in VS2008 that will read a webpage source code using a vb.NET function into a string variable. The problem is that the page is not *.html but rather *.aspx. I need a way to execute the aspx and get the displayed html into a string. The page I want to read is any page of this type: http://www.realtor.ca/...

Users IP Address when many NIC

I am wanting to get the users IP address (the logged in user will be running the application under there user context on there local PC), but many PC's in our environment have multiple NIC's that have been added by VMWare Workstation, I would like to exclude these type of bridged connections and only show the "primary" NIC on the PC. Th...

Change and retain DIV Selected tag in Master Page

I have a CSS class called selected which highlights the DIV as the current step. When they're all in separate pages, I just had to move the selected word to the next DIV. But how can I achieve the same in Master Page VB .Net? It seems to be one page for all. When the next page loads, how do I get it to highlight the next step? Thank you...

EventHandler Invoking question

I'm trying to invoke the below but the EventHander is not compatible with the RasConnectionEventArgs from my calling event, how would I invoke SetOverlayIcon and my notification icon on the UI thread? Public Sub watcher_Connected(ByVal sender As Object, ByVal e As RasConnectionEventArgs) If InvokeRequired Then BeginInvoke(N...

multiple webbrowser navigation freeze problem

Hi, I have problem with multiple webbrowsers on form so i created simple form with 10 browsers in it and 1 button: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click WebBrowser1.Navigate("http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/8a234c57-0872-469d-9b34-c89...

Searching systematic, comprehensive and complete comparison between the syntax of VB.NET and C#

I’m an experienced VB.NET developer, who wants to start with C#. I’m searching for a web based comparison between both languages syntax as quick reference. I found myself arranging VB.NET syntax templates such as... Public MustInherit Class BaseClass Public MustOverride Sub PublicMustOverrideSub(ByVal byValParam As Integer, ByRef b...

The process cannot access the file because it is being used by another process.

Hello everyone! I am adding images to a FlowLayoutPanel control via the following code Dim WithEvents Pedit As DevExpress.XtraEditors.PictureEdit Private Sub LoadImagesCommon(ByVal fi As FileInfo) Pedit = New DevExpress.XtraEditors.PictureEdit Pedit.Width = 133 Pedit.Height = 98 Pedit.Image = Image.From...

Creating Own Exceptions

I'd like some advice on building in known errors. Let's say I have a Windows form that needs to set the source path of an image in an object. It must be: A valid path An image A PNG 32 x 32 in size No transparency The thing about catching errors is that I'd like the class to handle the errors as much as possible, instead of the Windo...

Visual Basic .NET Scheduling Threads

Hello, I am having an issue where I need to implement a type of thread scheduling... I'm looking to implement a list of tasks, each with a set time that they need to execute, and after the time is up they will execute the respective code that goes with that task. I would use a timer based solution, however, I don't think that it would ...

What is the equivalent of |= in Visual Basic?

What is the equivalent of the |= operator in Visual Basic? For example (C#): flags |= MyEnum.SomeFlag ...

MVC Authorize attribute deny

Hi, I'm using the Authorize() attribute to secure my controllers/actions and want to only display the Login action to unauthenticated users - or to put it another way, deny access to authenticated users. I haven't been able to find anything on the web dealing with either denying permission or allowing negative permissions (ie !LoggedIn...

Handling file download in ASP.NET

Suggestion in either in C# or VB.NET is acceptable. I have a class to handle file download link ASP.NET project like the following: Public Class AIUFileHandler Public Shared Sub DownloadFileHandler(ByVal fileName As String, ByVal filePath As String) Dim r As HttpResponse r.ContentType = "application/...