vb.net

Cancelling databound control validating event doesn't suppress attempt to update data source. winforms, .net

I'm not getting the behaviour I would expect for a TextBox bound to an integer property in a business object. Here's what I did: (1) Set the DataSourceUpdateMode, for the TextBox to: OnValidation. (2) In the Validating event for the TextBox, set e.Cancel = True if Integer.TryParse fails. (3) Add a handler to Binding.Parse and Binding...

Marshalling and converting VB6 code to .NET

I am having trouble converting some code from VB6 to VB.NET (I don't have as much experience with .NET). When I run the 'Select function (from the WS2_32.dll library) in .NET, using the same parameters as the VB6 program, it returns a result of -1 (indicating an error). I think the error may be related to an upgrade comment I saw about m...

Populate the value in datetimepicker from the database

Using VB.NET I want to display the date in datetimepicker from the database. Code. cmd= new sqlcommand("select date from table1", con) dr = cmd.executereader while dr.read() datetimepicker1.value.add(dr("Date")) end while dr.close But it showing error as specified cast is not valid How to get a value? Need vb.net code Help ...

Dynamic dropdown based on Radio selection

Good morning all! Myself and a co-worker are tasked with a system-wide scripting solution but neither of us are .NET programmers so we need your help. We have a GUI that displays a radio selection box (3 options) that are the three sites where our hospitals are. We need to dropdown located on the form to fill with only the locations bas...

List files in FTP Folder in ListView?

Hi, I'm trying to figure out how to list all files of an FTP folder in a listview but I can't figure out how to do this. I tried using the same approach as if I were to list contents of a folder in my harddrive. But this fails. Any ideas? I thought of something like this (in vb.net, but I'm sure c# is pretty similar): Public Sub ...

VB.NET - Is this thread safe?

Let's say that I have a module that has a Queue in it. For other entities to Enqueue, they must go through a function: public sub InsertIntoQueue(Obj) MyQueue.Enqueue(Obj) end sub If I have multiple threads running and they want to call InsertIntoQueue(), is this considered thread safe? I am under the impression that there is on...

Problem Serialization

I'm getting the following Exception: There was an error reflecting type 'ValoradorHC.estruturas.dispoHotel'. when i try to Serialize my class My code is: Public Function getXMLdeObjecto(ByVal obj As Object) Dim ser As New XmlSerializer(obj.GetType()) Dim sb As New System.Text.StringBuilder() Dim writer As New S...

Performance Problem in .Net compact framework

Hi, I cant understand why sending parameters to insert function works slow in .net compact framework. Forexample following code inserts within 2 seconds cn = New SqlCeConnection(strstring) cmd = New SqlCeCommand Dim rs As SqlCeResultSet cmd.Connection = cn cmd.CommandType = CommandType.TableDirect cn.Open() ...

Problem with FedEx Address validation web service

Hi, I'm trying to get started with Fedex'es Address validation service and I'm running into a road block with FedEx's own demo application. This is the code in there app: Sub Main() ''# Build a AddressValidationRequest object Dim request As AddressValidationRequest = New AddressValidationRequest() Console.WriteLine("--- S...

.NET - When should I use a property vs. variable + accessor functions?

Is there ever a situation where I should do the following in .NET instead of using a property with read/write capability? private S as string public function GetS() as string return S end function public sub SetS(byval NewS as string) S = NewS end function Do properties simply provide a more efficient way for doing the same...

VB.NET Module - Can I force the use of <Module_Name>.Public_Member_Name when accessing pub. Members?

I have a situation where I have several VB.NET Modules in the same Logical-Module of a large application. I would like the update function of each module to be public, but I would like users to be forced to qualify the function call with the module name. ModuleName.Update() instead of Update() Is this possible? Thanks. ...

.NET - Is it possible to declare a module member accessible only to a namespace?

I'd like to declare some members of a module accessible to an entire namespace, but have them not be accessible from without. Is this possible? Thanks. ...

How to insert values into VB.NET Dictionary on instantiation?

Is there a way that I can insert values into a VB.NET Dictionary when I create it? I can, but don't want to, do dict.Add(int, "string") for each item. Basically, I want to do "How to insert values into C# Dictionary on instantiation?" with VB.NET. var dictionary = new Dictionary<int, string> { {0, "string"}, {1, "...

Loop to check time in VB.NET

So I'm kind of new to VB and am just playing around with a little project, I currently need a loop that is constantly checking the systems clock to see if it's equal to a certain time. While Not myTime.Hour = 24 If TimeOfDay = newTime Then nfi.ShowBalloonTip(15) intRandNumb = RandomNumber(1, 15) ...

VB.NET 2008 - How Do I Make Button.click Event Perform both the enter and period(del) keys on the numerical keyboard?

How Do I Make Button.click Event Perform both the enter and period(del) keys on the numeric keypad? Code snippet: Private Sub frmCalc_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown Select Case e.KeyCode Case Keys.NumPad0 btn0.PerformClick() Case Keys.Num...

How to generate a date for the given time?

Using VB.NET and SQL Server 2005 I want to generate a date according to the given Outtime, Am entering the value like ID Date Intime Outtime Holiday 001 23-02-2009 08:00:00 17:00:00 no 001 24-02-2009 17:00:00 08:00:00 no 001 25-02-2009 10:00:00 16:00:00 no 001 26-02-2009 18:00:00 20:00:00 no 001 27-02-2009 yes Ex...

How do I stop these stupid buttons from moving???

I have these buttons that contain images right, that have a drop-shadow effect, the opacity of which varies, depending on whether you are mousing over them or not. I have these buttons inside a wrap panel (and in one case, a stack panel). Now, (only on my home computer, not my laptop!), if I hover over a button that is not on the end o...

Json in VB.net version.

I have seen there are many example in C# version. Same also as DataContractJsonSerializer class in MSDN. Anyone pls help me on VB.net version. Regards. ...

Using DataGridView to Update Multiple Tables

On a VB.NET 2008 form I have a DataGridView, BindingSource and TableAdapter. The BindingSource DataSource is a dataset. In the dataset I have a Fill command that joins three tables and this is displayed without a problem in the DataGridView. However, I am unable to Update the dataGridView because it has multiple tables from a single T...

Regex: How to Uppercase the first character of each word?

Is it possible to uppercase the first character of each word using regex? I'm going to be using this in VB.net (SSIS) ...