vb.net

Can I use lambdas in a VB ASP.NET (2.0) project in VS 2008?

I built a small chunk of code based around lambdas in a VB Windows form project earlier which works perfectly, but it gives me "expression expected" warnings (which block compiling... should probably be considered errors, no?) when I copy the code to an ASP.NET project. The only difference I can see is if I make a Windows form project v...

Using Checkbox to Delete row in Gridview with Visual Basic.net code behind and Stored Procedures

Tools for my website. Visual Studio 2010 SQL Management Studio asp.net visual basic.net I am using GridView. Because of my search code I am not able to use the automatic delete function that GridView has to offer. I clicked on GridView, said "Add New Column" and added a checkbox column. I want to be able to check one or more boxes an...

ReSharper stops working

Running solution with VB.NET & C#, ASP.NET, VS 2008 with ReSharper 5 Most of the time, ReSharper is working (redundant code grayed out, squiggles, etc.) Sometimes, on the same code where it was working, nothing is highlighted to show ReSharper is enabled. I haven't done anything except modify code and debug. What is going on that tur...

Inline IF statement for ItemIndex asp:Repeater VB.NET

I am trying to do an inline IF statement inside a asp:Repeater control to add a class to the first item, but I can't quite seem to figure it out. Basically the code I have right now that is not working but should give an idea of what I'm "trying" to do looks like this. <asp:Repeater ID="rptrTabRepeater" runat="server"> <Item...

Manage frequently called WCF connection

Maybe I'm missing something basic here, so please correct me if I am. I have a local service and a WinForms app that communicate via WCF, but I seem to end up with a lot of copies of this code in my application: Public Shared Sub MyLocalMethod1() Dim tcpBinding As New NetTcpBinding tcpBinding.SendTimeout = New TimeSpan(0, 0, 5) ...

How to find and replace src and href from a string?

Dim r As String If r.Contains("src") Then r.Replace("src=\""", "") 'r.Replace("src='{0}'", "src='http://google.co.in'") End If Response.Write(r.ToString()) Response.End() ...

Determining a Generic Type at Runtime in Non-Generic Class

I've gotten myself in a pickle, and could use the help of a guru... I have a Journal that records entries for different types: Journal(Of ParentT) - Parent could be Customer, Address, other classes The constructor of the Journal requires knowledge of the Type parameter: Public Sub New(Parent as ParentT) In my consuming form, I take ...

Custom/Dynamic Methods and Delegates defined at runtime for hanlding events to tell me what event was triggered

Instead of hard-coding all conceivable events handlers, is there a way to do this dynamically at runtime? What I'm trying to do is define a dynamic method and a dynamic delegate at run-time to handle any conceivable event possible in VB.Net. I'm able to tell an event was triggered and the source object, but I'm not able to tell what ev...

Sorting list of string paths in VB.NET

Hi there, I would like to sort a list of strings which represent paths. The sort result will do have a hierarchical order. What I mean is: for each directory path, I want to list all files in that path (alphabeticaly or not doesn't matter) in first time. Then, each subdirectory path will be listed. For each subdirectory, I want all file...

Codedom and string handling

I've researched on this but couldn't find anything solid and wanted to see if someone can point me in the right direction. I'm trying to see if Codedom can handle strings and concantination between different languages, without me setting up conditional strings per language. For example, I need to generate the following exactly as shown ...

Log file behaving oddly

I made some changes to our log file since it was giving errors about being in use. Now it's chopping up the log file or not logging at all and its not usable. This is what the log looks like: vice(IndexInformation indexFileInfo, StringBuilder[] Keys) in D:\WORK\SOURCEVS2005\DLLs\DataLayer\DataLayer\DataHandler\DataHandler.vb:lin...

Locally unique identifier

Question: When you have a .NET GUID for inserting in a database, it's structure is like this: 60 bits of timestamp, 48 bits of computer identifier, 14 bits of uniquifier, and 6 bits are fixed, ---- 128 bits total Now I have problem with a GUID, because it's a 128 bit number, and some of the DBs I'm using only support 64 bit numbers...

How do you read a CSV file and display the results in a grid in Visual Basic 2010?

How do you read a CSV file and display the results in a grid in Visual Basic 2010? This sounds so simple but I still can't find the answer to it after googling for a while. I have DataGridView on a form and it's called DataGridView1. I have a csv with just 3 columsn of data and I want to be able to display them. ...

Why is my VB.Net WebClient.DownloadString request taking so long?

I am making a request from a web server for some text and displaying it in a textbox using the following code: Dim client As WebClient = New WebClient() Dim theText As String = client.DownloadString("http://192.168.1.110/text.html") Me.TextBox1.Text = theText When I run it the "client.DownloadString" command takes 6 or 7 s...

Parsing through XML Nodes - Creating an XML Based Scripting Engine

I'm trying to create a 'scripting' engine for my program. As the scripting needs to be cross-platform compatible (it is in VB for now and needs to ported to XNA later). I have sample data posted below. Anyway, within a script you can add graphical objects, play sounds, or perform other actions. Graphical objects have a time, duration,...

Change File Extension VB.NET

Hi. Is There any Function For changing a file extension in .NET? Or i have to rename a file? thanks For Example I want to rename each file in a directory with ".resxx" extension to .resx. what is the problem with my code? Dim [option] As SearchOption = SearchOption.AllDirectories [option] = SearchOption.AllDirectories Dim...

How Can I Put Escape Character before Special Characters using C#?

buildLetter.Append("</head>").AppendLine(); buildLetter.Append("").AppendLine(); buildLetter.Append("<style type="text/css">").AppendLine(); Assume the above contents resides in a file. I want to write a snippet that removes any line which has empty string "" and put escape character before the middle quotations. The final output would...

How to implement "Handles" via Codedom

I've been trying figure out how to add a handler to a method using Codedom, but am not getting very far. The method I want to reproduce via Codedom is: Private Sub Startup() Handles btnStart.Click ''# Do work End Sub The method is easy enough to create with: Dim StartupMethod As New CodeMemberMethod StartupMethod.Name = "Startup...

Remove row from gridview with datatable datasource

Hello. I am using VB.net. I have a gridview with a datatable datasource. What is the best option to update the datatable when i delete a row in the gridview and then show the gridview without that row? Thanks. ...

insert row into gridview from another gridview

Hello. I am using VB.net. I need to fill a gridview(1) with data that cames from another gridview(2), ie: (2) - All articles in the database. (1) - Selected articles from (2) What is the best way to do that? Thanks. ...