vb.net

ASP.NET How to get List of Groups in Active Directory

How can I get a full list of Groups in my Active Directory? ...

Compiler warning: null reference exception

I have the following code in Visual Studio 2005. Dim OutFile As System.IO.StreamWriter Try OutFile = New System.IO.StreamWriter(Filename) // Do stuff with OutFile Catch Ex As Exception // Handle Exception Finally If OutFile IsNot Nothing Then OutFile.Close() End Try But VS2005 brings up...

.NET Regular Expressions in Infinite Cycle

I'm using .NET Regular Expressions to strip HTML code. Using something like: <title>(?<Title>[\w\W]+?)</title>[\w\W]+?<div class="article">(?<Text>[\w\W]+?)</div> This works for 99% of the time, but sometimes, when parsing... Regex.IsMatch(HTML, Pattern) The parser just blocks and it will continue on this line of code for several ...

removing the "T" from a datetime when doing a xml+xsl=html with .net (XmlDataDocument,XslCompiledTransform,XmlTextWriter)

what is the easiest way to remove the "T" from the result? I want the result to be "YYYY/MM/DD HH/MM/SS" the vb.net code is really straight forward xmlDoc = New Xml.XmlDataDocument(data_set) xslTran = New Xml.Xsl.XslCompiledTransform xslTran.Load(strXslFile) writer = New Xml.XmlTextWriter(strHtmlFile, S...

Creating a web service without an ASMX file?

Hi, I have written an ASP.NET composite control which includes some Javascript which communicates with a web service. I have packaged the classes for the control and the service into a DLL to make it nice and easy for people to use it in other projects. The problem I'm having is that as well as referencing the DLL in their project, th...

WPF: How do I edit the contents of a DockPanel that is located inside a UserControl?

I've created a user control (in vb.net code) that contains two dock panels, one for header content (called HeaderDockPanel) and one for other content (called RootDockPanel). The dockPanels are depedency properties of the user control. These dependency properties are declared as follows: Public Shared ReadOnly RootDockPanelProperty As D...

How to use Windows Key in my Application

Like: Windows Key + E Opens a new Explorer Window And: Windows Key + R Displays the Run command How can I use the Windows Key in a KeyDown event of my Application? ...

Basic vb.net RegEx Matches question

I need to loop through all the matches in say the following string: <a href='/Product/Show/{ProductRowID}'>{ProductName}</a> I am looking to capture the values in the {} including them, so I want {ProductRowID} and {ProductName} Here is my code so far: Dim r As Regex = New Regex("{\w*}", RegexOptions.IgnoreCase) Dim m As Match = r.Ma...

Using List.Exists and Predicates correctly

All I am currently trying implement something along the lines of dim l_stuff as List(of Stuff) dim m_stuff as new Stuff m_stuff.property1 = 1 m_stuff.property2 = "This" if not l_stuff.exists(m_stuff) then l_stuff.add(m_stuff) end if This fails obviously as the Exist method is looking for a predicate of Stuff. Can anyone f...

Slow MSAccess disk writing

I'm trying to write a VB.Net program that saves 1-2 million 5-field records (plus an indexed ID) to an MSAccess table every day. The saving process currently takes 13-20 hours, which obviously can't be right. Its a flat table with minimal indexing, currently only 156MB. Except for one double field, the fields are small strings, dates,...

FXCop Rule for "If X = Nothing" when X is a nullable integer

1 Dim x as Integer? = Nothing 2 If x = Nothing Then 3 'this is what I think will happen 4 Else 5 'this is what really happens 6 End If The proper way to write that is "If x Is Nothing". Is there a FXCop rule that checks for this? Or better yet, can someone show me how to write my own? Jonathan ...

Creating a Serial Port in code in VB.net

Hi, I am trying to create a serial port in VB.net using code only. Because I am creating a class library I cannot use the built-in component. I have tried instantiating a new SeialPort() object, but that does not seem to be enough. I'm sure there is something simple I am missing and any help would be greatly appreciated! Thanks! P.S. ...

UI components for touch screen winforms applications?

I have seen this question: http://stackoverflow.com/questions/134067/are-there-any-decent-ui-components-for-touch-screen-web-applications and have allmost exact the same question but Im focused on winforms. I working on an application that is not primary made for using with a touch screen, but now I see more and more customers using to...

How can I refer to a control within its event? (without using it's name)

Is there a way in .net to refer to a control generically (so that if the control name changes, etc.) you don't have a problem. I.e., the object level version of the "me" keyword. So, I'd like to use something generic instead of RadioButton1 in the example below. Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, _ ...

Access internal file VB.NET

I added a text file to a testapp's solution and I want to read said file. I don't remember how to do this, I know it has to do with reflections but I need a push in the right direction. ...

What are the more advanced rules needed for your code to become CLS-complaint?

Here is a specific example which is not CLS-complaint according to VS.NET 2005. Public Interface IDbId Function GetNativeObject() As Object Function Equals(ByVal compObj As IDbId) As Boolean Function CompareTo(ByVal compObj As IDbId) As Integer Function ToString() As String End Interface This is an interface I implement with cla...

asmx wsdl string length

I have a VB class in an .asmx file in Visual Studio 2008: public class foo public bla as String end class It generates the wsdl value: <s:complexType name="foo"> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="bla" type="s:string" /> </s:sequence> </s:complexType> But what I want the wsdl to generate is: <xs:el...

Generating large sets of random data vb6/vb net

Is there an easy way in either language to generate a large set of random data quickly so far all the functions I've tried haven't worked too well when I need to generate a group of say 500,000 characters :( Any ideas? ...

VB.NET Extension Methods

Hi, when I apply the tag above my methods I get the error Type System.Runtime.CompilerServices.Extension is not defined. Here is my sample <System.Runtime.CompilerServices.Extension()> _ Public Sub test() End Sub Where am I going wrong? Edit ~ Straight from the MSDN Article here, the same error Imports System.Runtim...

Calling external gps app from VB.NET in CF 3.5 and returning back to VB.NET app

Hi All, I'm writing an app in VB.NET that allows the user to call Garmin Mobile XT to get a route. I've got a form that stays open behind Garmin and upon quitting Garmin, allows the user to go back. Sometimes, however, this form is automatically hidden by the WM OS. Any ideas how I can either get the form to stay put - or can I put a...