vb.net

Getting Service Tag from Dell Machine using .net?

Hello folks I've got a class that pulls model information (hardware info) for a local machine code is like so: Imports System.Management Public Class clsWMI Private objOS As ManagementObjectSearcher Private objCS As ManagementObjectSearcher Private objMgmt As ManagementObject Private m_strComputerName As String ...

Prioritize section of IF statement

I've got an IF statement that validates data. Basically looks like this: Dim s As String = Nothing If s Is Nothing Or s.Length = 0 Then Console.WriteLine("Please enter a value") End If Console.Read() I'd like to check to see if it's nothing first because if I write it this way, it throws a NullReferenceException. I've thought ...

call pylons controller from vb.net

Hello, i have a application thats writen with the pylons framework. Now i want to call some controllers from a vb.net application. How should i do this? I've tried it like this: Dim webclient As New WebClient Dim dataStream As IO.Stream = webclient.OpenRead("http://192.168.0.20:5000/controller/default") Dim reader As New StreamReader(...

My.Settings.MyConnectionString works but app.config dont?

I'm not a WinForms developer, but have been doing ASP.NET for quite some time. I have to write something in VB.NET that just pushes some simple data to a database. So I created the VB.NET WinForms app (Visual Studio 2005). When I run the app it works fine for using: Dim conMyData As SqlConnection Dim cmdInsert As SqlCommand ...

Coloring of User Types in Visual Studio 2008 and the future 2010

I really have an issue with Visual Studio's support for coloring User Types in VB.NET, I'm an C# developer that have been forced to code in Vb.NET by political rules in my organization, and I really misses the support for coloring user types in Vb.NET, I had hoped that this would be solved in Visual Studio 2010 and well in the beta they ...

Acessing Printers and Faxes folder on a network machine in asp.net

Hello, From my vb.net code I am trying to set a printer name for the crystal reports printing rpt.PrintOptions.PrinterName="\johnKing\HP LaserJet 2200 Series PCL" But when I go to windows-->Start--> Run and enter \JohnKing It is showing me Printers and Faxes folder and Scheduled task folder. But when I open Printers and Faxes it will...

Tooltips get hidden behind dropdown lists? How can you avoid this? (IE6)

I have a label with a tooltip attribute for rollover effect. This works all great. However, it seems to get hidden behind any dropdown lists that are nearby. I have tried adjusting the z-index, without any luck. This issue does not appear in firefox, and I have not tested it in later versions of IE. I realize this is probably due to...

How can I build a string from a collection with Linq?

I'm building flat file content from collections of strings. Example collection: A, B, C, D, E, etc. I want to be able to output these values to a string with line feeds in one swoop with Linq if possible. Sample Output: A B C D E etc. Here's the VB.NET code that does the job currently: For Each fieldValue As String In field.Va...

BinaryWriter Endian issue

I am using BinaryWriter class to write a binary file to disk. When I invoke the Write method, passing an unsigned short value, it writes it in little-endian format. For example: bw.Write(0xA000); writes the value in the binary file as 0x00 0xA0. Is there a way to make BInaryWriter use Big Endian? If not, is it possible to create a new...

Scrambling Text Elements in XML

How is it possible to take an XML document and in .Net scramble all text elements to make them un-readable to a human? E.g. Make <root><Node1>My Name is Ben</Node1></root> Into <root><Node1>klj sdlasd asdjfl</Node1></root> Points: We only need scrambling not encryption, i.e. not human readable at a glance. It doesn’t matter if...

In VB.NET can you do an arbitary code block?

probably a trivially easy thing to do... In C# you can introduce a block simply by putting in { } eg. if you wanted to do a lambda like x => { var x="x"; var y="y"; } so is there a way to introduce a scope / block in VB.NET? ...

"System.IO.FileNotFoundException: Could not load file or assembly" when the assembly does in fact exist

As part of our migration from .net 1.1 to .net 3.5, we had to change out a few vender DLLs. One of them is giving us trouble in only 1 spot out of the 4 spots we use it at: The trouble spot is a windows form project that uses reflection to dynamically load some DLLs that run long running processes. One of these long running processes i...

Using VB.NET If vs. IIf in binding/rendering expression

I'm trying to bind UI controls to a business object exposed as a property on an ASP.NET page in a null-safe manner. Using the 'If' operator is null-safe, but results in compiler error: Compiler Error Message: BC30201: Expression expected. Using 'IIf' succeeds, but isn't null-safe. I've tried both the render expression syntax ('<%= %>'...

slow exporting from access to excel

I have to generate about 800 excel files from an access database. For the first 10-15 of them it's working nice, a few seconds/excel file but it's constantly taking longer, at the 150th excel file it's taking 10 minutes. Here is my code: It's doing this for each nrliste in the access table (about 800 of them) Dim lista = From ls In L...

Working with ASP.NET DropDownList item not working - need an event?

I am working with ASP.NET I have a DropDownList item and in there i have hyperlinks as values. What event must i use in my code behind to redirect the user to that URL when he selects the "eRate" item? My code <asp:DropDownList ID="dropSelect" runat="server" Width="126px"> <asp:ListItem>Please select</asp:ListItem> ...

Show loading message on SelectedIndexChanged event of drop down list

Hi, I'm trying to show message "Loading..." when a user select an item in the dorp down list. Mark up: <asp:Label ID="lbl_LoadingMessage" runat="server" ></asp:Label> <asp:DropDownList ID="ddl_Chapter" runat="server" AutoPostBack="True"> </asp:DropDownList> Code behind: Protected Sub LoadMessage() lblLoading.Te...

Obscure VBMath random numbers generator behavior.

Hi, I want to repeat a random number sequence generated by a legacy software using the VBMath.Rnd and VBMath.Randomize functions in VB .NET Reading on the documentation for those functions on MSDN i found that you are supposed to "reset" the generator calling Rnd with a negative value if you want the same seed to give you the same res...

Finding a UNC Path on another server?

Hi, I'm need of some way of finding the UNC Path of a share via a script or command line or even a custom created program. I'm trying to automate deletion of users and the setup is a bit complicated. Home folders are set up like this: We create a folder on a Disk on a fileserver. When this folder is created, a share is automatically cr...

Convert blob to string in crystal reports in VB.net

Hello, I have crystal report and I am trying to create a pdf from the code using iText PDF API. I just have one problem. Though Crystal reports provide option to export directly to pdf, I need to insert some JavaScript inside the pdf so that when opened it will go directly to the printer etc. I need your help in finding a way to do so...

Serializing an ObservableCollection(of T) in VB.Net

I'm trying out MVVM in VB.Net for a while now and started out with some of my entities using List(of T)s, which I xml serialized to disk. Now, I updated the classes used by the Lists to implement INotifyPropertyChanged so I also changed the List(of T)s to ObservableCollection(of T)s. After which, the XML serializer stopped working :'( A...