vb.net

VB.NET Cross-threading operation not valid even though Invoke is used!

I've been reading around trying to find out why I'd be getting this exception to no avail. I hope someone has seen this before: I'm using Visual Basic 2010. Briefly, I have a "Settings Panel" form which takes a while to create (it contains a lot of labels and textboxes), so I create it in another thread. After it's loaded, it can be ...

What data structures in .NET do O(1) on Contains() calls?

I'm drawing a blank here; I can't find it, unless I'm really overlooking something under my nose. I'm trying to store a list of ints in a data structure. But after I add them, I will later in code check if an int exists in the list already. The generic List<int> does an O(n) operation with its Contains(). I want something that works ...

Does Mono support visual basic (not .NET)?

Someone asked me today if it was possible to port a visual basic application to Linux or similar platform, I assumed it was .NET so I suggested to use Mono, but noticed that on their vb support page they only talk about vb 8 (.NET) Does mono support non-.NET vb? In fact I'm not sure what he is using, I think vb6, I'm not sure of the ver...

VB.Net 2005, how can I subtract a date from the (current date minus 7 days) and produce a number of days ?

I have a date in the future e.g. 13/10/2008 I need to subtract the current date (today is the 28/09/2010) minus 7 days, so thats 21/09/2010 minus 13/10/2008, which would equal erm, 720 something ? But the current date won't always be 28/09/2010, obviously. I need the code for this. EDIT: When i said future I mean past :) ...

How can I convert this string to a date 21/08/2008 00:21:00 ?

I'm using vb.net 2005. How do convert this date / time 21/08/2008 00:21:00 to a DateTime object ? ...

Translation of yield into VB.NET

Hello, first i must assume that i'm not very familiar with the C# yield keyword and its function. What is the best/easiest way to "translate" it into VB.NET? Especially i tried to convert this code into VB.NET, but i failed with: yield return new MatchNode(++index, current.Value); What i have is: Imports System.Collections Imports ...

search methods faster

I am trying to search 33 .dll to find references for a method, It takes more than 10 minutes to through all the dlls and find references. Is there a way to speed up things. each of these dll's approximately has 450 classes and each of this class has approximately 200 methods each Step that I follow: ` assemblyName = System.IO.Path.Ge...

What is the best practice for ReadOnly Properties/Functions in VB.Net?

I'm not too new to VB.Net and the syntax, but I'm not an expert. I'm working on rewriting something in VB that was previously in C# and while I was doing so, I came across a "dilemna." I can have a ReadOnly Property: Public ReadOnly Property MaximumIndenture() Get Try 'If the connection is closed, open it.' ...

VB to C# rewriting question

I have a following method declaration in VB and need to translate it into C#: <DllImport("winspool.Drv", EntryPoint:="OpenPrinterW", _ SetLastError:=True, CharSet:=CharSet.Unicode, _ ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _ Public Shared Function OpenPrinter(ByVal src As String, ByRef hPrinter As IntPt...

Update Records in SQL Server database

I am using Visual Studio 2008 for creating a Winforms app. I have connected a database to it called XStats. There is one table in it called XGames and in that table 2 fields, XIndex (the primary key field) and GameNumber. Using the following code I can add records to the database, the data is taken from a text box, but once added I canno...

about datagridview

I have a form that I want to add the content of the datagridview to a listbox every time I double clik on the cell of the datagridview, then store the contents of the listbox in my database. please help. ...

get ip address from url

I am trying to get country location from the ip address which I am also looking up from actual url. However for certain urls I am getting the following error: The requested name is valid and was found in the database, but it does not have the correct associated data being resolved for I wanted to use the following code to identify ...

asp dropdownlist - add numbers 1-15 to list

Is there a way of adding the values 1-15 to an asp dropdownlist without having to do each one individually... I currently have: ddlAdults.Items.Insert(0, new listitem("1", "1")) ddlAdults.Items.Insert(1, new listitem("2", "2")) ddlAdults.Items.Insert(2, new listitem("3", "3")) ddlAdults.Ite...... ...etc but there has to be a better w...

how to set image width and height in vb.net

In html I just do <img src="x.jpg" width="1px" height="2px"> how about in vb.net. Is there an easy way to do this. When you are viewing the image through the picture box ...

.NET debugging an existing project

Background / Disclaimer First of all, please feel free to skip this entirely if you can understand the questions below. I'm still very fresh new to .NET, but an elder monkey on bad old ASP in regular VB. I just got into a company with some legacy .NET VB files and now I have a couple of huge projects, with over 50mb of files and about...

Handling Postback within a Webpart in Sharepoint

I am initializing a GridView, text box and a button via code to a Webpart in CreateChildControls() The above controls are declared as class variables but initialized only later. Next, I've given the handler for button click. The handler function is supposed to work as a search - perform some operations on the content entered in the tex...

Backup a database failure

Dim sqlDataAdapter As SqlDataAdapter Dim sqlCmd As SqlCommand Dim sqlCon As SqlConnection Dim _result As Integer Dim filePath As String = Application.StartupPath & "\BACKUP\ClinicBackup.bak" Dim folderPath As String = Application.StartupPath & "\BACKUP" Private Sub FullBackUp() Try sqlCmd = New SqlCommand() sqlCmd.C...

ASP.NET: How to display a different value returned from a database in a GridView

Markup: <asp:GridView ID="GridView1" runat="Server"> <Columns> <asp:BoundField DataField="status_column" HeaderText="Status" /> <asp:BoundField ... <asp:BoundField ... </Columns> </asp:GridView> Code: GridView1.DataSource = _dataSet DataBind() The values stored in my database are integers, 1 - 9. Each value ...

VB.net request username

I am building an app where i need to request user name and enter it into the database along with some other fields. Is there an easy way to request a username using vb.net? ie username = 'Home/JimJones' ...

How do I order by and group by in a Linq to objects query?

How do I order by and group by in a Linq query? I tried.. Dim iPerson = From lqPersons In objPersons Where Len(lqPersons.Person) > 0 Group lqPersons By key = lqPersons.Name Into Group Order By Group descending Select Group, key For Each i In iPerson tmp = tmp & vbNewLine & i.key & ", " & i.Group.Count Next The above ...