vb.net

Only one top level element is allowed in an XML document

hi guys, Following is the code for inserting new nodes in an xml file . Dim fleStream As New FileStream("C:\mailing.xml", FileMode.Append, FileAccess.Write,FileShare.ReadWrite) Dim stmWriter As New StreamWriter(fleStream) Dim writer As New XmlTextWriter(stmWriter) Dim currNode As XmlNode Dim doc As New XmlDocument doc.LoadXml(("<XMLFil...

How do I exclude multiple values in a sum, depending on values in 2 columns in SSRS 2005?

I have simple columns and their respective sums. However, I exclude 1 particular value from each sum, like so `=Sum(Code.ExcludeOthers(Fields!CATEGORY.Value,Fields!ACTION_PLAN_NEW.Value))` based on a value in 1 column as per the following code in my SSRS 2005 app: Public Shared Function ChangeWord(ByVal s As String) As String ...

How do I validate a string of XML against an XML Schema file

I'm developing a VB Web Application in .NET3.5 using Visual Studio 2008. I'm having difficulty in validating some XML as a string before I add it to a HTML form to post to a 3rd party. I have an XML schema file from the 3rd party to validate against and at this point I'd like the application to perform the validation before each post. ...

Activator.CreateInstance - Explain it so I can understand

So I am looking at some sample code, and I am not sure what to make of this: Private Shared _instance As PollsProvider = Nothing Public Shared ReadOnly Property Instance() As PollsProvider Get If IsNothing(_instance) Then _instance = CType(Activator.CreateInstance( _ Type...

What is the best way to approach creating a corporate .Net Namespace framework from scratch?

We are migrating our applications to VB.Net 2008 from Classic VB and I need to create a base namespace and business layer. My method of approach is going to be to visit our top BA and identify the common areas of our (Fixed Income) company and try to form a decent inheritence model with as much of the code in generics as possible. What'...

AppDomain.GetCurrentThreadID vs Thread.ManagedThreadID for Windows API calls?

Hi, I'm trying to create a hook to monitor the current position of the mouse cursor. Nothing important, I just need to count some pixels during interface design and wanted to learn how to create a hook, so I decided to go for a hard way instead of a sane way. I've found example code which declares the following function: <DllImport("U...

On Change event for dynamically created Drop dow list VB.NET

Hi, I have a website where the user requires to add and remove Headlines from the main page. The headlines are stored in a database with a column titled 'Display' (true or false) which decides if the headlines appear. I want the user to have the ability to add or remove headlines from the main page, so have created another page which cre...

What is the Generic version of a Hashtable?

I been learning basics of generics and it looks like it can really improve the performance of the application. But, I am not able to see the generic equivalent of Hashtable. Please share some sample C# code for creating generic hashtable classes. I need this for a demo. edit:Thanks for the answers. ...

Why does VS2005/VB.NET implement the IDisposable interface with a Dispose(disposing as boolean) overload?

Recently I needed to compare a suggested pattern for IDisposable and object finalization with the auto-generated one we which VS2005/VB.NET provide. We have used the auto-generated one a fair bit, but after looking it the two side by side I had a number of questions about the VB.NET implementation... For reference, here is the IDE's im...

<type1>'<typename>' must implement '<membername>' for interface '<interfacename>'

Hi, We have a web service solution in VB .Net 2005 that we have started getting an error in. We provide an interface like the following: Public Interface IBatchTrackerService Function InsertBatchTracker(ByVal BatchTrackerObject As BatchTracker, ByRef errorNum As Integer, ByRef errorMsg As String) As Integer End Interface In ...

DataTable.Select("Bla='Blablabla'").Count Returns 'Count' is not a member of 'System.Array' Exception

I'm trying to access the Count Property on the array of rows returned by the datatables select method, this is after converting the Web Project to 3.5 ...

How can controls (buttons) be set in a ModalPopup Extender panel that do NOT close the panel?

Here's the situation. When a user is editing a given piece of data, they're allowed to add messages/comments. These are stored as child records in a SQL database. Clicking on the Add Message button brings up a panel (pnlMessage) courtesy of the AJAX ModalPopup Extender. This takes some input and, when the "Send Message" button in the pa...

What exceptions should be thrown for invalid or unexpected parameters in .NET?

What types of exceptions should be thrown for invalid or unexpected parameters in .NET? When would I choose one instead of another? Follow-up: Which exception would you use if you have a function expecting an integer corresponding to a month and you passed in '42'? Would this fall into the "out of range" category even though it's not ...

Setting CLS compliance for a .NET assembly

Setting CLS compliance for an entire .NET assembly is possible. But how is it actually done? E.g. with Visual Studio 2008? ...

Why this code is not working while it worked fine for almost a year.

Does automatic software update causes some of the module property not to work? I am really scratching my head over this function that I have posted here. They are basically the same function that reads image logo from the currently executing assembly. Function named "Get2LogoImageStream" is different from "Get1LogoImageStream" by just Cu...

Problem declaring an anonymous method with vb.net Action(Of T) and lambda.

Imports System.Reflection Public Class Test Private Field As String End Class Module Module1 Sub Main() Dim field = GetType(Test).GetField("Field", Reflection.BindingFlags.NonPublic Or Reflection.BindingFlags.Instance) Dim test = New Test Dim GetValue = New Func(Of Test, String)(Function(t As Test) fie...

VB .NET Creating Additional Columns in Gridviews

Im trying to add data into a new column I have created in my gridview. I create the column with the code below: Dim Field As New BoundField Field.HeaderText = "Cummulative Amount" Dim Col As DataControlField = Field Me.GridView1.Columns.Add(Col) Now I need to go in and add data for the rows below the column. I have seen ppl saying I...

Error When Added MasterPage

Server Error in '/' Application. -------------------------------------------------------------------------------- Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature ver...

Error while clicking linkbutton in MasterPage

Hi guys, I am getting following error. Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. Description: An unhandled exception occurred during the execution of the ...

To get the path of file in a project in vb

hi guys, I am running windows application in vb.net.I have a xml file named mail.xml in folder named XmlFiles.In default.aspx.vb i have to get the path of mail.xml.What code i hve to write to make it possible? ...