vb.net

Localization of a DotNetNuke website

I am working on a website in dnn. I want to change the language of website or particular page. So I download the language package for spanish(es-es),chinese(zh-cn) and install them from host. Next when I changed the language of browser then the website language didn't change. Working on dnn 5.0. Please let me know how I can use languag...

Using a class like a public variable in asp.net

I'm getting an error in .net when trying to declare a Public class on my code behind page. Partial Class _Default Inherits System.Web.UI.Page Public someVariable as integer Public someClass as className Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load [...] The error I'm ge...

Filter a wpf collectionviewsource in VB?

Hi, I want to filter a collectionviewsource using a filter I've written, but I'm not sure how I can apply the filter to it? Here is my collection view source: <Grid.Resources> <CollectionViewSource x:Key="myCollectionView" Source="{Binding Path=Query4, Source={x:Static Application.Current}}"> <Colle...

Converting EBCDIC Char to Hex values (AFP EBCDIC data)

I working with some EBCDIC data that I need to parse and find some Hex values. The problem that I'm having is that it appears that I'm reading the file in with the incorrect encoding. I can see that my record begins with "!" (which is a x5A in EBCDIC) but when doing the conversion to hex it returns as a x21, which is the ASCII value for ...

How do I detect if I'm running in the console

Is there a simple way to have a code library automatically detect if it's being called from a console application or a windows application? I'd like my library not to report to the Windows Event log if it's being called from a console window, but instead report to the console window. If however, it's not being run from within a console...

Convert Boolean to Integer in VB.NET

What will this print, and why? Sub Main() Dim i As Integer Dim b As Boolean i = 1 b = i i = b Console.WriteLine(i) i = Convert.ToInt32(b) Console.WriteLine(i) End Sub I know what it prints (check revision history or run it yourself to see). I'm interested in the "why". EDIT: (Just a joke :) You ca...

restarting a single instance application

Is there any way of restarting a single instance application, which is deployed via clickonce? ...

How does For loop work in VB.NET?

I though that I know this one... I had no clue. This simple For loop: Dim i As Integer Dim n As Integer = 10 Dim s As Integer = 1 For i = 0 To n Step s Console.WriteLine(i) Next compiles into this (I put it through Refelctor, so it's easier to read). I couldn't even get what it does with all these bit-shifts: Dim n As Integer =...

VB.net Decimal.toString() for any Region

I have an app that deals with currency. For display purposes I use the nifty VB FormatCurrency function which will format based on the OS's region setting. So, if in France you might get 123,45 where in the US you would get 123.45. To perform calculation on these amounts I use CDec() to convert to decimal. My problem is that when I c...

How to achieve the C# 'as' keyword for value types in vb.net?

Most of our development is done in vb.net (not my choice) and one frequently used code pattern uses an 'On Error GoTo' followed by a 'Resume Next' so that all database fields can be read with a DirectCast() and any DBNull values are just ignored. The current code would be On Error GoTo error_code oObject.Name = DirectCast(oReader.Item(...

Exporting Data Or Code To A .png

How Do you Export Code To A .png In Order To Make It Animated? I Am Using VB.Net 2008 Express Edition. ...

How do you handle an event raised in your class inside your own class?

I have a "partial" class in VB.NET. Half of it is auto generated by a code generation tool. That half implements INotifyPropertyChanged, so any properties in that part of the partial class raise the PropertyChanged event. In my "custom" part of the class, I declare another property that depends on one of the properties in the auto-gen...

C# Help converting this code from VB.NET to C#

Any help would be appreciated, I'm trying to convert the code below to C#, I've never used VB.NET so ReDim is a new one to me. Thanks Dim inFile As System.IO.FileStream Dim binaryData() As Byte Dim strFileName As String strFileName = "C:\MyPicture.jpeg" inFile = New System.IO.FileStream(strFileName, System.IO.FileMode.Open, System.IO...

Can you send a Fax Via ASP.NET without Proprietary Software

I was wondering if it is possible to send a Fax via ASP.NET without using proprietary Fax software (i.e. using all .NET native classes) All I am after is to send a generated PDF to a remote fax machine rather than a printer. There is this question already, however this chap uses a 3rd party program as the Fax software EDIT: We have n...

Accessing members with case-sensitive names across languages in .NET

I just came across an interesting scenario. I have a class in C#: public class Test { public int A; public int a; } As C# is case sensitive, this will treat the two variables A and a as distinct. I want to inherit the above class in my VB code, which is not case sensitive. How will the VB code access the two distinct variables A a...

Custom DataTable searches

EDIT: Note. I should have mentioned I'm not interested in using the .Select, DataRowView, RowFind, etc. Thank you for those suggestions but the code as it stands, I was hoping to optimize. I wrote a function to search a datatable for terms in an array. I then return the datatable as a dataset so it can be bound to a DataGridView. Do...

How to capture a Phone Number

I'm looking to create a windows application in vb.net or c#.net that will capture the phone number of incoming calls. This would be a land line. What would the hardware requirements be? Which .Net libraries would be used? ...

What does ReliabilityContractAttribute do?

Does it do anything at all or it is only for documentation. If it is only for documentation, why documentation doesn't document it? For example these are two methods from System.Array class: [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)] public static void Copy(Array sourceArray, Array destinationArray, int length) ...

Casting in visual basic?

I'm a C# programmer who is forced to use VB (eh!!!!). I want to check multiple controls state in one method, in C# this would be accomplished like so: if (((CheckBox)sender).Checked == true) { // Do something... } else { // Do something else... } So how can I accomplish this in VB? ...

Rewriting Existing Functionality in the .NET Base Class Library

Relating to another question I asked yesterday with regards to logging I was introduced to TraceListeners which I'd never come across before and sorely wish I had. I can't count the amount of times I've written loggers needlessly to do this and nobody had ever pointed this out or asked my why I didn't use the built in tools. This leads...