.net - Setting Objects To Nothing?

Feb 24, 2009

If you have a sqlClient.sqlconnection object, in the cleanup code (finally block etc) do you dispose of the object or do you set it to nothing, or both?

I've always just called the dispose, and allowed the garbage collector to do its thing...

View 8 Replies


ADVERTISEMENT

Late Binding And Setting Objects?

Jul 28, 2010

I have a class from where I need to set objects in another form?

Form1:
vb.net
Function SetMyObject(ByVal frmTarget As Object)
frmTarget.PictureBox1 = Form1.PictureBox1
End Function

(Not tested code, just wrote to show what I mean)So that's the late binding one.I should also say that the frmTarget variable isn't static so thats why I can't make something like Form2.PictureBox1 = Form1.PictureBox1

View 11 Replies

Setting And Calling 2 Printer Objects?

Jan 26, 2011

i have 2 types of transaction that can print but these 2 have different settings.how can i configure it on app.config?and how will i call the printer object?scenario:2 transactions, different printer to call.

View 1 Replies

Setting Default Prefixes For Objects?

Jun 7, 2010

After adding any control or object to form from datasource or toolbox, vb postfixes object type name to that control e.g. for Name field NameTextBox, for Component like Data Adapter say AddresesDataAdapter, AddresesBindingSource and so on.Here i want to ask you that may i change this default way to identify the object i.e. may i set prefixes desired for diffrent objects.

View 7 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

Child Objects Raising Events In Parent Objects?

May 1, 2009

long story short, I have created a ListView type control, using UserControls for the parent control and the ListViewItems. Most the of the control is written and works fine, right up to the point where I tried to replicate the 'Control.SelectedItems(0).Index' property and the 'SelectedIndexChanged' event.

Each child object knows its index value, and could pass this value via the SelectedIndexChanged event (assuming this is how it works in a normal ListView control -- user clicks on an item, and that item fires an event updating the selected index value in the parent object).

How does the child object raise an event in the parent object? I have a feeling this could be done with Delegates, but I'm still learning about their usage.

View 1 Replies

Setting Short Function By Setting Poker Game Points?

Aug 23, 2010

I need help and wondering if you can help me to get my first project...it's a hobby and wondering if you can get me code for this so i can see how it does it* Evaluate( ) Prints the evaluation of the hand to the evaluation Label.

o If IsFlush( ), prints "flush; "
o calls SetPipArray( )
o Uses a For Loop to go through pipArray. For each element, uses a Select Case statement to

[code]....

View 9 Replies

Setting Variables To Store User Setting For Applications

Feb 13, 2012

In our projects we use setting variables to store user setting for the applications. Moreover, with every latest version of the applications, we upgrade these variables to retain user settings.Normally, this works fine, but recently one of my end user reported an error i.e.Configuration System failed to initialize". The error is related to user.config file. Therefore we requested the user to send us his file.After received the folder, we noticed that it contains 3 files (3begfjb.newcfg,3begfjb.tmp and user. config). 3begfjb.tmp is an empty file, while 3begfjb.newcfg and user.config are identical files. We tried to open these files but the data in user.config isn't proper xml rather its unreadable formatted file.Do any you guys had experienced this sort of issue or any ideas how and what may have created these files and corrupted user.config file.

View 3 Replies

ASP.NET Cast ArrayList Of Objects To Custom Objects?

Aug 9, 2011

getting the following error Unable to cast object of type 'System.Object[]' to type 'OrderService.webdirect_WebLinesRow[]'. On the line

webdirect(web_companyID, web_locationCode, web_customerNumber, web_orderNumber, web_orderReference, web_orderDate, webLinesArray.ToArray(), o_Company, o_LocationCode, o_CustomerNumber, o_OrderNumber, o_OrderStatus, o_OrdDescrip, webRespArray)

I created the webLinesArray.ToArray() array as such

Dim webLinesArray As New ArrayList()

Am I missing an additional cast or something ?

View 1 Replies

Compare Two Objects To Check If All The Properites Of Both The Objects Have Same Value Or Not?

Aug 28, 2008

I want to compare two objects to check if all the properites of both the object have same value or not. for this i need to use the reflection to enumarate through all the properties of an object and check the value of the property. To try the code just i have written a Employee Class having Two Properties EmployeeNo and EmployeeName. I am creating an object of the Employee class and need to write a function that can list the values of all the properties in the class.

[Code]...

View 2 Replies

Bind Objects With Nested Objects?

Jul 21, 2009

I am tring to bind a class to a form where the class contains other class variables. For example:

Class Character
Private _name as String
Property Name as String

[code]......

View 5 Replies

Array Of Child Objects In Nested Classes And Accessing Child Objects In .Net

Jan 3, 2012

I have a nested class, let's call it class1 and it has class2 inside it; VB.Net eg:[code]

1) How can I define X number of Class2 objects[let's call it: Node(x) array]** with NEW() subroutine called?' this raises error: dim cls2(n) as new class2 end sub.

2) How can I return actual number of Node() array? [code]Outside my class in main project I define cls1 object:[code]Now an array of class2 is created inside cls1.

3) Now,How can I access All of them[node(x) array which is created inside cls1] with all properties and methods available?

I remember I wrote a ProcessManager class with this functionality in .net 2003, nearly 4 years age, I don't have the code now.

View 1 Replies

Multithreading - Create Custom Objects/list Of Custom Objects In .NET?

Jan 24, 2010

I need two seperate lists, which every item is Integer, String, Bitmap - and one which every item is Integer, String String. However I don't know how to do this, or even where to look - I've googled for custom objects and custom object lists. What I'm trying to do is this.Custom Object1 is Integer, String, Bitmap Custom Object2 is Integer, String, String

In one thread I'll be adding items to List1(Of Object1), and processing them, and adding the results to List2(Of Object2), however I need to be able from other threads to look at the list and say only give me the items where Integer = (my thread ID), is this possible? Any help, or even links to information that would be relevant to this request would be helpful?

View 2 Replies

Can Objects In Objects Be Persistent

Dec 15, 2009

[Code] I want that once I put something in the BigCollection it stays there, I don't want it to be changeable from outside. I want to be able to clear the SmallCollection but it should not be cleared in the BigCollection. Any Ideas?

View 1 Replies

Casting Objects To Other Objects?

Feb 6, 2012

Firstly I need somebody to explain a bit of code to me, I'm a massive newbie at programming so I need an in depth explanation.

Private Sub Box_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
Dim C As PictureBox = CType(sender, PictureBox)

[code].....

View 2 Replies

.NET To Parse This XML Into Objects?

Sep 29, 2009

What's the easiest way in VB.NET to parse this XML? Here's an example of the full source:View Source XML I believe that the XML can be read directly into a class structure that matches the XML's structure.Let's take a bit of the XML from the above example,

<?xml version="1.0" encoding="UTF-8" ?>
- <kml xmlns="http://earth.google.com/kml/2.0">
- <Response>

[code]....

How do I handle nested collections, for example, the Placemark collection in this example?

View 2 Replies

Add Randomness To Objects?

Dec 20, 2011

I want to start by saying that I am very new to programming so please be take this in to account when responding.

I am trying to finish my masters thesis and have to run a small program to assess how individuals can rank several different patterns on the basis of how random the pattern looks.

So i need to create patterns with varying degrees of randomness. Some with very little randomness and others that are completely random.

The way I thought I would accomplish this was to make the pattern out of a bunch of smaller objects or primitives. Then call out each object and then add in a random displacement to the object. For increasing randomness increase the amount of displacement (scale within the RNG?).

View 9 Replies

C# - Where And When To Use LINQ To Objects

Feb 21, 2009

In which situations I should use LINQ to Objects?

Obviously I can do everything without LINQ. So in which operations LINQ to code shorter and/or more readable?

View 7 Replies

Can't Loop Through More Than 3 Objects From AD

Sep 5, 2011

As I wrote in topic.I'm using DirectoryServices to connect to remote AD

When I write Collection.Count it prints for me for example 198 - co it's good.But when I want to loop through this collection ('for each' or 'for') application shows error that counter should not be greater than collection or below 0.

View 4 Replies

Change Objects On Top Of Each Other

Nov 24, 2011

How do you change on a picturebox what object (image) overlaps what object?

View 1 Replies

Classes And Objects?

Aug 29, 2010

The 1st part of the code required me to write a class definition for a class(Worker). The class should include Private variables and Property procedures for a worker object's name and salary.

The salary may contain a decimal place. The class should also contain two constructors:a default and a parameterized.

The second part for the code indicates that I need add a method named GetNewSalary to the Worker class.The method should calculate a Worker objects new salary, which is based on a raise percentage provided by the application using the object.

Before calculating the new salary, the method should verify that the raise percentage is greater than or equal to zero. If the raise percentage is less than zero the method should assign the number zero as the new salary

There are three text boxes which allows the user to enter the employees name current salary and raise percentage....the calculate button will display the new salary in the new salary label box...so far here is what I have for the worker class.

The Class for the code had to be written from scratch. Can you please look over the class code and see if I need to chang anything....that will allow the program to run.[code...]

View 1 Replies

Getting Objects To Communicate With Each Other?

Jan 26, 2011

I'm coding a restaurant program where every table, server and guest is a different object - Is there a right way of getting objects to communicate with each other?For example, one server might have 5 table objects, each table might have 2 guest objects. Is there a way to neatly tie all this information together. If a guest moves to a different table I have to change a large number of variables (number of guests served by server, table set to empty, new table sat...etc etc.)?

View 2 Replies

Using An Array Of Objects

Jul 29, 2009

ok first off my over all goal is to create a simple database program. I need to have an index file that i can search and then load the item data from a path refferenced from the index file. So i was thinking that if I have a IndexClass object, that has the following varribles: name as string, Desc as sting, and ImagePath as String.

[Code]...

View 6 Replies

Using Is To Compare Objects?

Jan 2, 2010

So I am working on a project with a lot of pictures in my resources and I am trying to check what picture has been put into a part of my array. I am using structures in my array and i'm not sure if that will make a difference.

If logs(i).pic Is My.Resources.Log2 Then
logs(i).gap = 70
End If

[code]....

View 2 Replies

Using Objects In A Method?

Apr 16, 2012

I have some procedures I want to store in a module and call up to use in the form.My problem is that the radio buttons are not being transferred into the module. I think I need a line of code at the beginning of the method so it has access to all the objects created in the form.

The error I am getting is:[rb#] "is not declared. It may be inaccessible due to its protection level"

rb# are radio buttons that are being used in the main form.form:

[Code]...

View 3 Replies







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