Easy Way To Iterate Through Objects?

Jun 25, 2009

Lets say I have 30 text fields in a Frame on my form, and I want to set them all to disable (so users can't edit them).Is there an easy way to walk through those fields without having to create an array of text fields?

I.E., in ... VB 6, with an array of text fields, I can do something like this:
For i = 0 to 10
txtfield(x).enabled = true.
Next i

Is there something in VB.NET where I won't have to use an array of controls, something like this (assuming all txt fields are in a frame):

[Code]...

View 6 Replies


ADVERTISEMENT

Collection To Place These Objects In For Easy Reference?

Nov 11, 2011

I have an error while using a collection that has been stumping me for years.I wrote a class to allow users to write equations in a txt file using RPN (stack based notation).The class runs through a select statement while reading the equation and then ends up with a final number as the answer. I have a collection to place these objects in for easy reference. For whatever reason I get random object reference not set to an instance of an object errors when there is nothing in the program that would remove objects from the collection, kill objects, or change the collection in any way. It is possible for one thread to call the calculate function while another thread calls the CurrentValue property. I'm not sure if this could be causing the error, but once it happens I get an error every time the program enters that code until I run out of memory.

[Code]...

View 4 Replies

Easy Way To 'rewrite' To Take Advantage Of Classes And Objects?

Jul 2, 2009

I have a VB.NET web app that is about 2000 lines of code, contains about 20 different subroutines, and about 50 different functions.Is there an easy way to "rewrite" this to take advantage of classes and objects?

View 5 Replies

Iterate Over Two IEnumerable Objects At The Same Time?

Jun 11, 2009

If I have a List(Of x) and a List(Of y) is it possible to iterate over both at the same time?

Something like

for each _x as X, _y as Y in List(of x), List(of y)
if _x.item = _y.item then
'do something
end if
next

These lists may be of differing sizes. I am using .Net2.0 which I suspect is my downfall here as I have a feeling LINQ would solve something like easily by joining the lists on there common id.

View 7 Replies

Traverse / Iterate Through All The Objects Inside A Form?

Feb 18, 2010

I have a VB class inside which one of the methods accepts an array of forms. For each form inside the array, I need it to traverse all of the objects, check if they are a specific tyoe (input, label, checkbox, etc.) and get the properties of each object. Then, I want to dump these into a text file in the following format:

[Code]...

View 4 Replies

UI-threading An Easy Way To Fix It?

Jan 23, 2012

I am communicating with a USB-HID device. It will successfully complete hundreds of send-receive requests but occasionally get a Null Exception error.

[Code]...

at the rxData.dataPacket(i) = element I will get a NullReference error every now and then. I could enclose it in a try/catch statement, but I'd like to fix the root problem if possible.This device is communicating to microcontrollers, and it is possible that they won't always give a value... but my feeling is this is some sort of UI threading issue. When debugging, even though there is a null exception, many times there actually does seem to be data in dataReceived.data.ToList(). Is there an easy way to place the whole data processing routine on a thread separate from the UI?Edit: Changed code to match answer and give more info on where it is used. Still get NullReferenceExceptions after about 1,000 completed send/receive requests to the HID device.

View 2 Replies

.net - VB Flamed For Being Easy And Yet Python Is Not?

Sep 19, 2010

I have always wondered about this and seen this among lots of programmers. Why is a VB programmer or VB code easily dismissed as too noobish and easy while the same does not apply to Python or Python code? After all, isn't Python as easy as VB is? And it does provide drag-n-drop GUI application building also. So why is it that VB is flamed and yet Python is not?

View 1 Replies

An 'easy' Way To Capture Video?

Apr 15, 2012

I've been trying to play with DirectShow but it's getting on top of me and my question on here didn't answered so I'm thinking maybe I should go with a different approach. (DirectShow VB.net can't change recording format). <- Where as that 'works' I can't get it in the format I want it, and I don't really understand it so I'd obviousl like to go down the route of something I can get my head around.

I've googled till my fingers are raw trying to come up with an easy way to record video in my vb.net application, it doesn't have to be fancy, just a preview with a start record, stop record button, that's it.

View 2 Replies

Best And Easy Resources Material?

Feb 14, 2010

iam very keen to learn vb.net 2008 so please suggest me how to access world most and best free of cost reading material available on net for reference.and free best book available for vb.net 2008 on the net. there is any complete source code available for consideration.

View 2 Replies

Easy Way To Run Procedure In Background?

Sep 27, 2011

I'm running stored procedure from asp.net front-end but it's quite long. What is the easy way on running that thing in the background? I mean if I close the browser, I still want my stored procedure to complete not just die. Also, I would like to perform other actions on the front-end while my procedure is running.

View 3 Replies

Finding Way For Easy Encryption?

May 22, 2009

Is there an easy way to encrypt things? Here is some code I got:

[code]...

View 9 Replies

Why Isn't There An Easy Way To Display Date

Nov 17, 2010

I have 2 datetime components in my application. [code] How do I do it? How do I get it so my 2 datetime controls display the current 24 hour time?

View 14 Replies

.net - Rectangle Width(probably Easy To Answer) VB?

May 2, 2012

Dim energybar As New Rectangle(9, 154, energy, 21)That is my new rectangle, now when I draw it e.Graphics.FillRectangle(Brushes.Blue, energybar)It says there is no width but the integer energy is = to 100...now, how do I fix this? It but be somewhat simple.

View 1 Replies

Easy Way Of Reading And Writing To / From Register

Apr 20, 2009

I have been using what I think is a simplistic and easy way of reading and writing to/from the registry but whenever I look at code I keep seeing links to DLL's and constant decorations and lines and lines of code.[code]

View 2 Replies

Easy Way To Detect Internet Connectivity?

Oct 28, 2009

I saw another forum which discussed how to detect whether a LAN was connected, but I need to know whether my Internet connection from my ISP is up or not (I'm writing a program for day trading, so knowing if my internet connection is down is critical). I know I can simply open a browser in VB and browse to a site and see if it doesn't come back "page not found", but that involves a fair amount of overhead, and if the internet is down, it often takes many seconds to a minute to come back with "page not found". Is there some simple command that will quickly tell me that my internet connection is working? I'm using VB in VS 2008, and currently using XP although I plan to convert to Windows 7 in the next couple months.

View 3 Replies

Easy Way To Wait For Keypress From User

Jul 30, 2009

I want to have a one second pause after some code has run. During that pause, if a certain key is pressed, I want to do some action. Otherwise, I want the code to continue as normal. What would I use to replace the comments in the following code?

myTestCode()
' Wait one second and see if a given key was pressed.
' If specific key is pressed, then show messagebox (or whatever) asking user if we should cancel (whatever)
NextMethodToRun()

Yes, I know there are a number of ways, which is why I am looking for something that is fast and simple to use. I do not want a console window, some other form, etc. to appear. Just want to check if a key was pressed. The key (if pressed) should be pulled off the keyboard buffer.

View 1 Replies

GetLineWithText Minor Dilemma, Easy Fix?

Aug 22, 2010

Dim lines As String = System.IO.File.ReadAllText("C:12345.txt")
Debug.Print(GetLineWithText(lines, "swf"))

[code].....

View 2 Replies

How To Make Setup File In Easy Way

Jun 8, 2011

After we finished make a project , we need to make setup file right ? is the setup file contain all the component we use in our vb.net ? like Crystal Report component

View 1 Replies

Interop.ADODB.dll To Ado.Net / Easy To Change?

Feb 8, 2012

My app currently uses Interop.ADODB.dll to retrieve data from an access database.My compiled setup file has to include a Interop.ADODB.dll file for the software to work.What would i have to do in order to convert my app to drop the interop file by using Ado.net instead?Would it simply be a matter of changing the references and connection strings or does it involve alot more than that?

View 3 Replies

Make A Document Nice And Easy

Feb 19, 2011

I want to create a document, nice and easy like a word , or a rapport in access and .just it is easy to layout and so on.

View 5 Replies

Quick & Easy Code To Detect OS?

Dec 24, 2009

Ran across a snippet a while back but can't seem to find it again. Was very short and simple and detected all versions using version major and minor.

View 4 Replies

Retrieve Image From Access Db The Easy Way Around?

Mar 30, 2011

I use this code given by .paul

Dim ms As New IO.MemoryStream
PIS.PictureBox3.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg)
dsNewRow.Item("picture") = ms.ToArray

[code]......

View 4 Replies

VS 2008 Cannot Display Info Easy One

Dec 21, 2009

I am brand new to VB2008 from VB6.I am trying to connect to my remote mySQL db and simply display a record into a label.Here's what I have on Form Load.[code]

View 4 Replies

Make Objects From The ToolBox Using Code Instead Of Changing Existing Objects Invisible Then Visible Later?

Dec 5, 2011

make objects from the ToolBox using code instead of changing existing objects invisible then visible later?

View 7 Replies

Sql - Error The SqlParameterCollection Only Accepts Non-null SqlParameter Type Objects, Not Int32 Objects?

Jun 23, 2012

I am getting this error, Not sure why it is happening "Error The SqlParameterCollection only accepts non-null SqlParameter type objects, not Int32 objects."I have tried with all sorts of possibilties, now try to enter default data as dummy data,

Using connection As New SqlConnection
connection.ConnectionString = ConfigurationManager.ConnectionStrings("DentalDeviceConnectionString").ConnectionString
connection.Open()[code].....

View 1 Replies

Modifying Objects Inside For Each Loop Sets Properties Of All Objects With Values Of Last One?

Jan 29, 2011

I have a program like this.

Module Module1

Public Class Mstr
Public Property Prop1 As String
Public Property Prop2 As String[code]....

But it is not working as I expect it to. You can see it from.The DtlsB properties of all three DtlsA objects are having values from last iteration.

View 1 Replies

Random Objects - Let The User Input Objects To A Richtextbox 1 Object On Each Line?

Jan 6, 2011

I want to let the user input objects to a richtextbox 1 object on each line, and somehow use Random.Next to select pseudorandomly a few objects, the number 'few' inputted in a textbox.

View 9 Replies

The SqlParameterCollection Only Accepts Non-null SqlParameter Type Objects Not String Objects?

Jan 18, 2012

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Using conn As New SqlConnection("Database=Clinic_Management_System;Data Source=.SQLExpress;Integrated Security=True;AttachDBFilename=|DataDirectory|Clinic Management System.mdf")
Dim cmdRecord As SqlCommand

[code]....

View 2 Replies

VS 2008 Inherit ListView - Dispose Of Two Objects When The Form's Disposing Of It's Objects

Feb 7, 2010

I have a user control that inherits the FW ListView and I need to dispose of two objects when the form's disposing of it's objects. Here's what I've concluded already, am I on the right track?

[Code]...

View 3 Replies

Best Place For Easy Eaxamples Of RegEx For Beginners

Dec 8, 2010

I have founfd numerous ones on the net, but they all only do these complicated RegEx for zip codes, html, address, credit card numbers, etc etc,All I want to accomplish is when the user searches for "commend", they get only every occurence of the word "commend". NOT commendeth, or commends, or some other variation.[code]

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved