vb.net

C# trouble using bouncy castle libraries

I'm attempting to encrypt something then decrypt it. The code shown below is VB but I'm using it with the C# libraries, I've tried the same code in C# as well with the exact same exception thrown. I'm encrypting the text using the RSA engine and the private key file from streamreader. Writing that to the console works fine, but the inval...

What does Function(Of T)(ByVal x as Integer) actually mean?

I'm fairly new to this concept. I see some functions within some code that are: Public Function GetDataObjects(Of Customer)(ByVal dataset as DataSet) ... End Function What exactly does the (Of Customer) do in this instance or mean? ...

Creating a Custom Start Menu Shortcut Link for a Visual Studio Setup Project

Is it possible to create a custom start menu shortcut link? The only possibilities I see in the setup project are shortcuts to folders or primary output. Update: What I ended up doing is creating a custom action on commit that dynamically creates the link using Windows Scripting Host. Then on uninstall, removing the link. ...

How to apply formatting string when binding DateTime to MaskedTextBox?

I have a MaskedTextBox that has the mask 00/00/\2\000 (restricting input to XX/XX/20XX) and DateTime values with a single digit month or day recently started displaying incorrectly. The MaskedTextBox.Text property is bound to BindingSource.SomeProperty (of type DateTime.) I know that at some level of data-binding the ToString method is...

how to write this into linq to object query?

from a list, which got 3 attributes I want to return a new list of that class where attribut1 recurrence in the list equals X for an example this; 1,a,b 1,c,d 1,e,f 2,a,b 2,c,d 3,a,b 3,c,d 3,e,f 4,a,b 5,a,b 5,c,d 5,e,f 6,a,b 6,e,f where X = 1 would return that list 4,a,b where X = 2 would return tha...

Intercept file access on a network share in .NET

I am looking for a way to possibly intercept the point that a file is being accessed on a network share. Specifically before it is determined whether the user has access to the file or not. The goal will be to grant access to that file if the file request is coming from a specific process and that user currently does not have access. ...

problem with internet explorer showing html input button which is hidden

I have a vb.net program that has a web browser control, and we all know that it is using the web browser in the computer before internet explorer. And my problem is, it doesn't recognize this css code: <style type="text/css"> @media print { input[type=button] { display: none; } } I used that to make the print button invisible wh...

Draw a shape in GDI+ that overlays opaque pixels with transparency

I have a mask bitmap (bmpMask) that I am drawing onto a destination bitmap (bmpDest). Both bitmaps have alpha channels but are already full of opaque content. What I want to do is produce transparent areas using GDI+ 'Draw...' methods on bmpMask so that bmpDest shows through when I draw bmpMask over it. Of course gMask.DrawLine(Pens.T...

is it possible to add a reference to other browsers in vb.net

The web browser in vb.net is using IE or maybe its not even a web browser. Maybe its the primitive browser in windows that came before IE. Is it possible to change the browser that is used by the vb.net web browser(dragged from the toolbox)? Maybe through the add reference? ...

Limit number of Rows that can be entered in a datagridview based on property of DGV

I have a UI that uses datagridviews / bindingsource / datatables of typed dataset for data entry. The dataset itself is serialized to a varbinary(max) in SQL. (i.e. no tableadapter, backend schema) I would like to limit the number of rows the user can enter into some of the grids (the data is used to fill PDF forms and I don't want th...

Identifying a device by retrieving its USB ID

I'd like my application to be able to detect a where a particular USB device has been mounted, and adapt accordingly. Ideally, I'd associate paths with a USB serial number, rather than with a given path. However, I cannot figure out a simple way to access these unique IDs from VB.Net code. Has anybody succeeded in doing this? ...

Days difference between two dates

I've been trying many ways to calculate the round number of days between two dates, I mean, counting the whole days. An example of what I need: START DATE END DATE Day Count 24/02/2010 16:26 24/02/2010 16:26 1 20/02/2010 18:16 24/02/2010 16:26 5 31/12/2009 20:00 24/02/2010 16:26 ...

SQL IErrorInfo.GetDescription error.Brackets not working

I have the following code. I tried putting brackets around all the tables and parameters with no luck. The query works in Access though. Dim cn As OleDbConnection Dim cmd As OleDbCommand Dim str As String Dim dr As OleDbDataReader DataGridView1.Rows.Clear() Try cn = New OleDbConnection("Provider=microsoft....

LINQ to XML: suppressing redundant namespace attribute in child nodes

If a node belongs to a namespace, it's children by default belong to the same namespace. So there's no need to provide an xmlns attribute on each child, which is good. However. If I create two nodes like this: Dim parent = <parent xmlns="http://my.namespace.org"/&gt; Dim child = <child xmlns="http://my.namespace.org"&gt;value&lt;/chil...

Capturing International Personal Data (Name, Address, Phone, etc) ASP.NET

I am looking for the best way to capture and validate US & international personal data. I have to use ASP.NET 2.0 (vb.net) and no 3rd party web services. This are all client restrictions. The main point of this is I have to toss their data to FedEx for a shipping quote. I think FedEx has a address checker but that web service was not a...

What is the difference between "instantiated" and "initialized"?

I've been hearing these two words used in Microsoft tutorials for VB.NET. What is the difference between these two words when used in reference to variables? ...

vb.net: index number in "for each"

Sometime in VB.net i have something like: For Each El in Collection Write(El) Next But if i need the index number, i have to change it to For I = 0 To Collection.Count() - 1 Write(I & " = " & Collection(I)) Next Or even (worse) I = 0 For Each El In Collection Write(I & " = " & El) I += 1 Next Is there another way of ...

How to Get Font Properties from a Font File Name?

I'm trying to use Linq to loop through all fonts in the %windir%\Fonts folder and find the one that has a property title of "Arial" (or any Font Family name supplied), but I can't seem to access the font properties (things like "Title", "Font style", "Designed for", etc.). The following is only giving me the basic file info: Dim f...

Differences between how C# and VB handle named parameters?

Now that C# supports named parameters, I was checking to see if it was implemented the same way VB did it, and found that there is a slight difference. Take for example a library function like this: public static void Foo(string a, string b) { Console.WriteLine(string.Format("a: {0}, b: {1}", a, b)); } In C#, if you call it lik...

Getting a value in Combobox problem

Using VB.Net I want to fill a combobox with table values by using 3 tier Architecture Code. DAL Public Function Combo1(ByVal cmb1select As string) As SqlDataReader cmd = New SqlCommand("Select Name from table1", con) dr = cmd.ExecuteReader While (dr.Read()) cmb1select = (dr("Name")) End Wh...