vb.net

Partial Classes, LINQ, Interfaces and VB.NET

Okay, I have ran in to a problem with VB.NET. So all those defenders of VB.NET please can you help me out? Here is my issue: I am using LINQ to Entities, it also works with LINQ to SQL, I build my edmx file I then create a Partial Publc Class of the same name as one of the entities All fine up to now, so here comes the problem. I need ...

Why would Cint("1") fail?

I'm attempting to deploy a WinForms app in a Citrix environment. It's been working reliably for some time on other physical and virtual machines, but it's failing, only when running the application on a Citrix desktop. The failures are typically where we have mixed-type data as strings in a general-purpose settings table in the (SQL Se...

TableName in Linq

hi My Sql Query in Vb.net is like this: Dim TableName As String ="City" Dim Str As String="Select * from "+TableName+"" I got TableName from another Form .how we can do this in linq? can we use TableName in Linq query dynamically? please help me? ...

how to create Toolbar in window Application using C#

i want to create toolbar using window application in dotnet.it will use yahoo,gmail API. please anybody have any solution pls send me. ...

Extracting Album art from MP3 files using TagLib - Is there a better way write this code?

I'm using Visual Basic 9 (VS2008) and TagLib. The following code extracts the album art from an MP3 file and displays it in a PictureBox. Is there a better way to write this code? Dim file As TagLib.File = TagLib.File.Create(filepath) If file.Tag.Pictures.Length >= 1 Then Dim bin As Byte() = DirectCast(file.Tag.Pictures(0).Data...

How to update a Lucene.NET index?

I'm developing a Desktop Search Engine in Visual Basic 9 (VS2008) using Lucene.NET (v2.0). I use the following code to initialize the IndexWriter Private writer As IndexWriter writer = New IndexWriter(indexDirectory, New StandardAnalyzer(), False) writer.SetUseCompoundFile(True) If I select the same document folder (containing file...

How to test for String = Enum.Value?

How do I do a simple compare of an enum value and a string that should match the enums name? How do I parse the string into it's appropriate enum value. For example, Enum A B=0 C=1 D=2 End Enum How do I check if String = A.C and how do I convert string into its corresponding A value without comparing it to a string re...

Is there a (relatively) painless upgrade path from ASP.NET 1.1 to 3.5?

One of my clients has an e-commerce CMS written in VB.NET 1.1. (The original solution was authored with Visual Studio 2003.) It's not an enormous site, but it does consist of around 40 or 50 Web forms, and I'd like to upgrade it to .NET 3.5, and to maintain and continue developing it it with VS 2008. I's sure I could do it surgically,...

Table Filed

hi My code that can get tablename in linq query is: Dim TY As Type = (From T In DB.Mapping.GetTables() Where T.TableName = tableN Select T.RowType.Type).SingleOrDefault Dim Table As ITable = DB.GetTable(TY) Dim mq = From t In Table Select t tableN get from another form. I w...

Possible to override VB.NET root namespace?

VB.NET automatically prefixes the root namespace set in the project properties to the namespace of each class. This is different from C#, where the full namespace must be declared each time. Is it possible to override this behaviour, creating a namespace outside of the root namespace? ...

Setting Foreign keys in Linq to SQL

It's well known that you cannot set foreign key IDs directly in Linq to SQL if the entities have already been loaded. You can however look up the entity by it's foreign key and then set the entity as the foreign entity using the entity relationship. (I've taken out the enum here and used integer values for simplicity). i.e. If I have a...

[LUCENE.NET] How to use a field from Index to delete an entry?

I'm developing a Desktop Search Engine in VB 9 using Lucene.NET I wish to delete and create a new entry for a file that is updated. The Index stores complete file path and the last modified date. doc.Add(New Field("path", filepath, Field.Store.YES, Field.Index.UN_TOKENIZED)) doc.Add(New Field("modified", New FileInfo(filepath).LastWri...

File Compressed by GZIP grows instead of shrinking

I used the code below to compress files and they keep growing instead of shrinking. I comressed a 4 kb file and it became 6. That is understandable for a small file because of the compression overhead. I tried a 400 mb file and it became 628 mb after compressing. What is wrong? See the code. (.net 2.0) Public Sub Compress(ByVal infile A...

Com Object Exception

I wrote an application that loops through a set of records and prints two things. One is a report from SSRS wich works correctly. The other is a drawing that uses a COM object to print. The COM object randomly fails and causes the program to quit. Is there a way to stop it from killing the entire program when the COM Object fails? ...

How do I programmatically determine the location of the VB application log?

I'm retro-fitting an older vb.net application to bring it into compliance with LUA principles in Vista. Up until now, the application has used a hodgepodge of logging mechanisms, but the core one involved writing a log to c:\temp\ if the folder existed. I want to replace this current logging with a more standard logging mechanism. Thi...

Are there any code review websites that support C# and VB.NET? Similar to www.pastie.org?

Are there any free web-base code review websites, similar to pastie.org, that supports both C# and VB.NET? I think this is a great tool for looking at code, but it's pretty much worthless to me without C# and VB.NET support. Update Here is a related question http://stackoverflow.com/questions/1542/online-peer-code-review, but again...

Run new process as different user in vb.net

I'm currently using a homegrown method to run a process as a different user in Vista, and I can't escape the feeling that's it hack-ish and less than ideal (in addition to the fact that it craps out UAC, crashing my app with a security exception, and forcing me to disable UAC altogether). My process consists of two projects (so two EXE f...

Convert List(of object) to List(of string)

Is there a way to convert a list(of object) to a list(of string) in c# or vb.net without iterating through all the items? (Behind the scenes iteration is fine - I just want concise code) Update: The best way is probably just to do a new select myList.Select(function(i) i.ToString()) or myList.Select(i => i.ToString()); ...

asp.net: partial classes and inheritance

I have a class split across two files. One of these is generated, the other contains the non-generated stuff. I want my class to inherit from a base class. Do I need to have both files inherit? Or will the class inherit from the base class if either partial class In generated foo.vb: Partial Public Class Foo Inherits BaseCl...

Why won't my ASP.NET CustomValidator validate?

I must be doing something wrong. I can't seem to execute my CustomValidator's ServerValidate method. I've got a Visual Basic ASP.NET page with a CustomValidator... <asp:TextBox ID="TextBox1" runat="server" /> <asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="TextBox1" ErrorMessage="Friendly message g...