Shared Hashtable Between Different Apps?

Nov 3, 2010

I currently have a ASP.NET Website and a Windows Service doing some work together.It consists in running some processes either using scheduling or on-demand requests.Basically before i had the windows service i used a Shared Hashtable to register all the on-demand requests and avoid duplicate requests for the same ID. I tought i could use the same hashtable to add the scheduled requests also... but somehow they are being created in separated hashtable's.I think its because the windows service uses a diferent instance of the website.

PS: in the hashtable i save full class objects for future reference so the solution must be able to achieve the same.

View 3 Replies


ADVERTISEMENT

.net - Why Can't Call Private Shared Methods From A Public Shared Method

Aug 25, 2011

I have a class like this:

[Code]...

It works, when I make getBar methods public, but I don't want to expose these unneccessarily. Why I can't call private shared methods from a public one in the same class is over my head. I'm using .net framework 4.0 in a web application.

View 1 Replies

Windows.Forms Based Apps Vs WPF Based Apps?

Jun 21, 2010

what WPF based apps are?Is it an application that runs under Silverlight? If so, how?I know; Windows Forms based apps,console apps,DLL _ Class Library Projectsand I've had an introduction to ASP.Net.What I mostly want to know is, if WPF apps are for Silverlight then do they also run in a server based fashion like anASP.NET website would when you create ASP.Net webpages?Is it a way of creating what looks like a FORMS BASED application but it runs in a browser instead or what?Please enlighten me a bit further as I have no idea what WPF is all about.

View 3 Replies

Asp.net - Public Shared Variable Shared Between Users?

Mar 30, 2012

I've taken over the maintenance of the website (ASP.NET VB) and on one particular page I noticed the below code

Inherits System.Web.UI.Page
Public Shared UserNumber As String
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init

[Code]....

My question is whether the variable UserNumber can be accessed or changed by any other user than the current one?

View 2 Replies

Shared Method Not Calling Shared Constructor

Aug 12, 2009

Given in the following language specification, for me at least, calling Db.Foobar() [In the following code] does not indeed call off to the Shared Constructors of the base classes. I am curious as to a) is this my own fault for doing something wrong or b) is this an error in the language specification[code]...

View 2 Replies

Get A Hashtable Key Name From A Value?

Jul 20, 2010

I have a hashtable in VB.NET and I need to get the string value of a key from it's value. For example, if I do: hashtable.add("string1","string2") How would I get the value "string1" if I had "string2"?

View 2 Replies

Put A Hashtable In Another Hashtable?

Jan 1, 2012

Can you put a hashtable in another hashtable? I'm trying to make Tetris and to represent the grid of the gamefield I want to have an hashtable within another hashtable. The code is as followed

Public Tetrisfield As Hashtable
Public TetrisRow As Hashtable
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)

[Code].....

View 3 Replies

Using A HashTable Key?

Feb 22, 2009

I'm using a HashTable that stores information typed by the user in textboxes on a form. There are 4 textboxes on my form including, Name, Number, account representative, and total count of things added. Besides the text boxes there are 3 buttons on the form, one or adding a record, one for deleting one, and one for display the selected name from the listbox.

Everything pretty much works for me at this point, but I just have one question. When the record is input into the listbox it is supposed to display the users name he or se just entered in the name textbox. Now then, our professor wants us to use the number for the keyString for the HashTable.

That is the problem, if I use the number, instead of the name displaying in the listbox, the number displays. Is there a way to display the name in the listbox instead of the number? Once I have assigned the number as the keyString, am I stuck displaying that value only?

View 1 Replies

How To Serialize A Hashtable

Nov 2, 2009

I have a hash table in which the key is of type Point and the value is of type PieceOfBoard. PieceOfBoard is derived from PictureBox. How do I serialize this hashtable to save it to a file?Do I need to add anything to the PieceOfBoard class?

View 3 Replies

C# - What Is The Generic Version Of A Hashtable

Apr 21, 2009

I been learning basics of generics and it looks like it can really improve the performance of the application. But, I am not able to see the generic equivalent of Hashtable. share some sample C# code for creating generic hashtable classes. I need this for a demo.

View 5 Replies

Create Hashtable With Values?

Oct 12, 2010

Is it possible to create a hashtable "pre-populated" with values?[code]...

View 2 Replies

Hashtable Key Not Recognised In Collection?

Jan 27, 2010

I am using a hashtable to cache incoming UDP messages before my application processes them. After adding pairs to the hashtable, I am experiencing strange behaviour when interogating the collection, such that a containsKey() enquiry returns false, even though the key exists and is visible in the locals window. Spelling etc is correct, manually calling GetHashCode on the key (String) at each point (add() and containsKey()) is returning different values for the same key. To complicate things more, some keys are matched successfully.

View 2 Replies

Using A Hashtable To Keep Track Of Forms?

May 9, 2011

I was using the For Each frm as From In Application.OpenForms but it seemed a bit inefficient to loop thru every open form when I already knew what I was looking for. After some googling I found some information about hashtables so I used the following code. This code works as long as another form, say form3, isn't open with the same ID. What I am trying to figure out is, why is the hsh.contains only looking at the key instead of looking at the key/value pair?

Form1
Public hsh as New HashTable
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

[code].....

View 2 Replies

.net - Storing And Calculating Data Into Hashtable?

Dec 13, 2010

I am making a small tool that require some calculation. I am using hashtable to store values that I need to calculate. This tool continuously extract data on specific time interval(30 seconds) from webpage and add those data into the hashtable. Now the problem is I need to store the previous extraction data and when new extraction occurs, I need to deduct the previous data from new data.

[Code]...

On first run it shows the result of Data3 = 100 which is currect. But on second run I need to redefine the value of Data2 = Data1 . So I need a result of Data3 = 0 on second run. This may not be the proper way to do this sort of operation. I have also tried using listbox, listview and even textfile to store the Data2 and recall that on second run. But could not make it possible.

This is the last phase of my tool and I am stuck with it.

View 1 Replies

C# - Get Closest/next Match In .NET Hashtable (or Other Structure)?

May 7, 2012

I have a scenario at work where we have several different tables of data in a format similar to the following:

Table Name: HingeArms
Hght Part #1 Part #2
33 S-HG-088-00 S-HG-089-00
41 S-HG-084-00 S-HG-085-00

[code]....

Where the first column (and possibly more) contains numeric data sorted ascending and represents a range to determine the proper record of data to get (e.g. height <= 33 then Part 1 = S-HG-088-00, height <= 41 then Part 1 = S-HG-084-00, etc.)

I need to lookup and select the nearest match given a specified value. For example, given a height = 34.25, I need to get second record in the set above:

41 S-HG-084-00 S-HG-085-00

These tables are currently stored in a VB.NET Hashtable "cache" of data loaded from a CSV file, where the key for the Hashtable is a composite of the table name and one or more columns from the table that represent the "key" for the record. For example, for the above table, the Hashtable Add for the first record would be:

ht.Add("HingeArms,33","S-HG-088-00,S-HG-089-00")

This seems less than optimal and I have some flexibility to change the structure if necessary (the cache contains data from other tables where direct lookup is possible... these "range" tables just got dumped in because it was "easy"). I was looking for a "Next" method on a Hashtable/Dictionary to give me the closest matching record in the range, but that's obviously not available on the stock classes in VB.NET. what I'm looking for with a Hashtable or in a different structure? It needs to be performant as the lookup will get called often in different sections of code.

View 3 Replies

C# - Sorting Hashtable By Order In Which It Was Created

Nov 2, 2010

This is similar to How to keep the order of elements in hashtable, except for .NET. Is there any Hashtable or Dictionary in .NET that allows you to access it's .Index property for the entry in the order in which it was added to the collection?

View 5 Replies

Convert Argument Function In Hashtable?

Jul 23, 2010

I try to convert names and values parameters of function into a hashtable. For name of parameter, it's ok, but not for value.

Function test(ByVal param1 As String, ByVal param2 As String) As Hashtable
Dim hash As Hashtable = New Hashtable
Dim stFrame As New StackFrame

[Code]....

There is a property to get default value of parameter (if optional) with param.DefaultValue but how to get current value ?

View 1 Replies

Declaring Public Variables New Hashtable

Dec 8, 2009

recently started converting our project from 1.1 to 2.0

It was fine with the following:

Public ghtAllAppMsgs As New Hashtable(300)

Now it is complaining to change to the following is this the right way:

Public ghtAllAppMsgs As New System.Collections.Hashtable(300)

This is under global.vb class file: here are the imports i already had in this file:

Imports Microsoft.Web.UI.WebControls
Imports Microsoft.Web.UI.WebControls.MultiPage
Imports System.Web

[Code]......

View 1 Replies

Multi-client / Server App That Needs To Use A Hashtable

Feb 16, 2010

i have a multi-client/server app that needs to use a hashtable but i am getting an unexpected result because each timei call a sub from form1 the hashtable get recreated and erases all the data. [code]

View 12 Replies

Printing Out Large And Complex HashTable?

Jan 25, 2012

Is there a VB equivalent to PHP's print_r available? I have a very large and complex hashtable that I would like printed out.

View 3 Replies

Storing And Calculating Data Into Hashtable?

Dec 25, 2009

I am making a small tool that require some calculation. I am using hashtable to store values that I need to calculate. This tool continuously extract data on specific time interval(30 seconds) from webpage and add those data into the hashtable. Now the problem is I need to store the previous extraction data and when new extraction occurs, I need to deduct the previous data from new data.Here is the process I am currently following:

Dim MyTable as New Hashtable
MyTable.Add("Data1","200")
MyTable.Add("Data2","100")

[code].....

View 5 Replies

Create A "shared" Variable That Is Shared With All Instances Of A Class?

Jan 14, 2011

I seem to be drawing a blank. I'd like to create a "shared" variable that is shared with all instances of a class but not classes that inherit from it. For example.Class A: Shared list As New List(Of String): list.Add("A")

Class B Inherits A: list.Add("B")Class C Inherits B: list.Add("C")The end result I'd like is that any instance of A has just A in the list. Any instance of B has A and B in the list. Any instance of C has A, B, and C in the list. I can accomplish it by creating Instance variables, but I have to construct the list for each instance of a class. I'd like to construct it once for a specific point in the Hierarchy and then share it accross other instances of that class.

View 12 Replies

Use Derived Class Shared Variables In Shared Methods Of Base Class?

Jun 4, 2010

I am trying to add shared members in derived classes and use that values in base classes...

I have base

class DBLayer
public shared function GetDetail(byval UIN as integer)
dim StrSql = string.format("select * from {0} where uin = {1}", tablename, uin)
end function
end class

[Code]..

currently there is error using the tablename variable of derived class in base class but i want to use it i dun know other techniques if other solutions are better then u can post it or u can say how can i make it work? confused...

View 2 Replies

Bind HashTable Keys To A ListBox In Program?

Jan 12, 2011

I'm helping a friend port some code that I have written in Java to Visual Basic.NET. VB.NET is not my language of choose, so I am entirely new to it's quirks. How can I display keys from a HashTable in a ListBox?

View 2 Replies

Convert A String Of Key / Value Pairs To HashTable Or Dictionary Or?

Jun 19, 2010

In VB.NET, how can I convert the following string into some kind of key/value type such as a Hashtable, Dictionary, etc?"Name=Fred;Birthday=19-June-1906;ID=12345".I want to extract Birthday or ID without having to split the string into an array.I'd prefer not to split the string into an array in case the format of the string changes later.I don't have control over the string.What if someone switches the order around or adds another element?

View 6 Replies

Dictionary Or Hashtable And Iterating In Reverse Order?

Oct 18, 2010

I need to place objects of various types in a "collection" and be able to:

1) Change the value of a property on any of the objects by using it's key.

2) Read the objects in the order they were placed in the "collection"

3) Read the objects in the reverse order they were placed in the "collection"

My findings so far:

1) Collection won't work because Item property is read only

2) It seems that Hashtable and dictionary won't work because I cannot iterate through them in reverse order.

3) Stack won't work for obvious reasons.

Is there a collection like data structure that has satisfies the requirements?

View 16 Replies

Hashtable - Get String Representation Of Object Reference

Jun 3, 2011

I want to make a hashtable of object references and I want a different object's reference to be the key. How can I do this in vb.net? In java (assuming I am using the default toString method and that add() takes a string as a key and an object ref as the value) this would be something like: hashtable.add(obj1.toString(), obj2)

I do not want to use a vb.net gethashcode() function because I want deep clones of objects to have different identifiers. A related question is what is the default toString in vb.net? How can I get a string that represents an object reference in vb.net?

View 3 Replies

Hashtable Value Array (late Binding) Error?

Feb 26, 2011

I have a hashtable that stores sports players: key = jersey number, value = an array of information...and what I am trying to do is put this information into combobox (but only showing a certain array elements), so for example say this was the information stored in the hashtable:

(key,{value})
"01",{"john smith","125lbs","qb"}
"02",{"john doe","205lbs","rb"}

so what I have done is created an arraylist that will store the items in the combobox.but my problem happends when I try to loop through the array from the hashtable values.

(playerlisting is the hashtable)
Dim playerlist As New ArrayList

[code]....

The above works, however since it's a foreach loop I cannot specify which array indexes I want to add onto the "listitem" string.

Dim arr As Array = CType(item.Value, Array)
For i = 0 To arr.Length - 1
listitem += arr(i) & " "
Next

But, when I try a simple forloop instead I get a "late binding" error with the 3rd line. Even when I cast the arr(i) as a string I get the error. What needs to be changed?

View 3 Replies

Import Hashtable's Fields In A Adodb Recordset?

Oct 26, 2010

The field's names of hashtable are same of fields adodb.recordsetHow can i import the fields value of hashtable in fields adodb.recordset without do it manually?[code]....

View 1 Replies

Save HASHTABLE To Data Or Text File

Dec 3, 2007

how to save hashtable object to data or text file like (sample.dat or sample.txt)
i got this class Name Book.

[code...]

if i run this application it works, but if i close the application the hashtable items will be erase.i want to save the items to dat file or txt file.i got some idea but it doesnt work, i use the file stream :[code...]

View 2 Replies







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