vb.net

Display Pdf Stream on page load with Binary Write

I have a pdf file being generated on the fly which I want to display inline on pageload, as below Response.Clear() Response.AppendHeader("Content-Disposition", "inline; filename=_Bulk_Print.pdf") Response.ContentType = "application/pdf" Response.BinaryWrite(docData) Response.End() If I put this in a click event it work...

Why does this extension method throw a NullReferenceException in VB.NET?

From previous experience I had been under the impression that it's perfectly legal (though perhaps not advisable) to call extension methods on a null instance. So in C#, this code compiles and runs: // code in static class static bool IsNull(this object obj) { return obj == null; } // code elsewhere object x = null; bool exists = !...

Filtering DBNull With LINQ

Why does the following query raise the error below for a row with a NULL value for barrel when I explicitly filter out those rows in the Where clause? Dim query = From row As dbDataSet.conformalRow In dbDataSet.Tables("conformal") _ Where Not IsDBNull(row.Cal) AndAlso tiCal_drop.Text = row.Cal _ AndAlso Not IsDBN...

Fastest way to do an unchecked integer addition in VB.Net?

I have a project where I want to have checked arithmetic by default, except for one performance sensitive spot. Unfortunately, VB.Net doesn't have an 'unchecked' block. Ideally the framework would have some sort of integer type with explicitly unchecked arithmetic, but I didn't find anything like that. I did find that expression trees h...

Add reference to VB Script Task in SSIS 2008

I am trying to add a standard .NET reference (System.DirectorySearcher) to a VB Script Task in SSIS 2008. I was able to do this in SSIS 2005, but when I try to add the reference in 2008, I get the following error: No template information found. See the application log in Event Viewer for more details. To open Event Viewer, clic...

dataset using where condition from another query

here's my code. I have a dataset that has its values and then i run an independent query which uses the same tables as dataset. now when i run the dataset, i want it to get a where condition on the query result. here's the code - sql = "SELECT ID, name FROM books WITH(NOLOCK) WHERE id =" & Session("ID") ds = FillDataset(sql) ...

Getting value from field in DataTable when column name has spaces

I have tried: ObjDTOleDBNFeIntegra.Rows(I)("[Cnpj Cpf]").ToString() //with brackets ObjDTOleDBNFeIntegra.Rows(I)("'Cnpj Cpf'").ToString() //with apostrophe ObjDTOleDBNFeIntegra.Rows(I)("Cnpj Cpf").ToString() //without anything I'm using VB.NET, but comments with apostrophes in here don't seem to be identified. And I get the exc...

How can I make a class recognize that an interface found in a separate file exists

Hi, I've made an interface called ApprovalEvent in a separate file with the namespace myproject... I've also made a class called PurchaseOrder... it's also in the same namespace, just in a separate file. Whenever I try to make PurchaseOrder implement ApprovalEvent it always says that ApprovalEvent is undefined... How can I make the cla...

LINQ-to-XML selection based on node values, newbie question

Given the following XML, I would like to return all eventtitles where the eventtype id = 23. My current query only looks at the first eventtype, so returns the wrong result. <event> <eventtitle>Garrison Keillor</eventtitle> <eventtypes> <eventtype id="24"/> <eventtype id="23"/> </eventtypes> </e...

VB.Net MailMessage text encoding issue

I have an ASP.Net app that allows a user to write text into a Telerik RadEditor control and then send an email. For some reason I'm sometimes getting strange characters showing up in the email that is generated. For example if I put the word Test’s into the RadEditor box and send it... the email shows up with the text changed to: Testâ...

Splitcontainer, Make a fixed panel

I have a splitcontainer with horizontal orientation. I want a fixed height for panel2 only during form resize, and let splitter resize panel2 Now I'm doing it this way, but I'm not satisfy because user notice that the panel resize Private Sub Form1_ResizeBegin(ByVal sender As Object, ByVal e As System.EventArgs) _ Handles Me.ResizeBe...

(New Object()).Method() in VB.net

Apparently this does not work. WHY ??????? I don't want to do all this just to call my function: Dim x as new Object() x.Method() WHY do I have to do this in 2 lines when I can in one. This is really pissing me off. ...

WPF User Control is causing Out of Memory Exception

Looking for a free spell checking solution, I thought I was so smart in doing this but I guess not. I have created a windows form based application and I want the form to add a user specified amount of user controls (with textboxes) on to a panel. The user can then click some button and the controls on this panel are cleared and new one...

Can I programatically get hold of the Autos/local variables that is shown when debugging?

Im trying to build an error-logger that loggs running values that is active in the function that caused the error. (just for fun so its not a critical problem) When going in break-mode and looking at the locals-tab and autos-tab you can see all active variables (name, type and value), it would be useful to get hold of that for logging ...

CSV Parser in one routine/function?

I know there are several libraries of code out there that can parse CSV files according to the standard, but, for various reasons, I need one simple routine (not an entire library) that parses a CSV into a DataTable or array. Does such an animal exist or is it extinct? (Preferably C# but i can translate vb.net too) ...

Is there any difference between using .GetValueOrDefault(0) and If(variable, 0) with nullable types?

Is there any difference between the 2 methods below for calculating c ... specifically boxing/unboxing issues? Dim a As Integer? = 10 Dim b As Integer? = Nothing Dim c As Integer ' Method 1 c = If(a, 0) + If(b, 0) ' Method 2 c = a.GetValueOrDefault(0) + b.GetValueOrDefault(0) ...

FormCollection in VB.NET

Hi, I want to detect if a window form is open and if it is then I would like to bring it in front rather than opening it again. I know I need a form collection for this but I want to know if there is a built in form collection that holds all the forms in VB.NET or I need to implement my own. Thank you. ...

.Net BindingDictionary

I have started using BindingList(Of T) for my generic collections whenever I need the objects to interface with the GUI instead of List(Of T). This has worked well for me so far but a few of my collections are stored in Dictionary(Of TKey, TValue) and there doesn't appear to be a corresponding BindingDictionary(Of T). Has anyone else co...

Why can't you return a List from a Compiled Query?

I was speeding up my app by using compiled queries for queries which were getting hit over and over. I tried to implement it like this: Function Select(ByVal fk_id As Integer) As List(SomeEntity) Using db As New DataContext() db.ObjectTrackingEnabled = False Return CompiledSelect(db, fk_id) End Using End Functio...

How to connect to Oracle 10g server from client machines

I have installed Oracle 10g in one of my office's computer. I want to keep this as database server. I am developing a .net project which will communicate with the database server from client machine and from the server machine. I success to communicate with oracle from server machine but not from client machine using the .net project. Th...