473,811 Members | 3,686 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can I use a variable as the first parameter in a NameValueCollec tion?

2 New Member
Instead of:

NameValueCollec tion nvc=new NameValueCollec tion();

nvc.Add("A","Al pha");



I want to do:

nvc.Add(somevar , "Alpha")

Is there hashing going on against the key?

I have tried.... somevar = """ & myvar & """ and every other thing I can think of...

Please help...
Jun 26 '11 #1
1 1024
Gary Morris
2 New Member
I figured it out with a little help. The problem is this:

nvc.Add(somevar , "Alpha") does work after all...the minor nuance is that it doesnt work for me if the variable has any spaces in the string being stored.

For example:

somevar = "THEKEY" works just fine, but
somevar = "THE KEY" doesn't work at all in my app.
Jun 26 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
936
by: Richard L Rosenheim | last post by:
I'm trying to create a style sheet to generate HTML output, based upon some XML data. I'm grouping some data, and I'm trying to get the very first entry either just passed as a parameter, or placed into a variable (which I can then pass). I would like to differentiate some of the formatting for the first item. I've tried a number of things, none of which worked out. Among other things, I tried passing the first entry as a parameter...
2
2200
by: ad | last post by:
I write a javascript function, it require a string parameter: <asp:TextBox ID="TextBox1" runat="server" onclick="MyJavascript('Tiger');"></asp:TextBox> I want bind a variable to the parameter, like: <asp:TextBox ID="TextBox1" runat="server"onclick="MyJavascript('<%#sName%>');"></asp:TextBox> and write some code in the code behind file:
3
3107
by: kd | last post by:
Hi All, I need to check whether an application is executing. I do not know the class name of the application; however, I know the window caption of the application. What would be the first parameter that I should be passing to the FindWindow API, in order to check whether the application is executing? Thanks. kd
6
14227
by: Jody Gelowitz | last post by:
I have run into an issue with variable scope within an XSLT document that is translated in VS.NET 2.0. Under VS.NET 1.1 (XslTransform), this code works fine. However, when using VS.NET 2.0 (XslCompiledTransform), the exact same XSLT transformation fails with the error: System.Xml.Xsl.XslLoadException: The variable or parameter 'lastrecordwaskit' was duplicated within the same scope. An error occurred at (174,12). at...
2
1403
by: Gigsman | last post by:
public void Foo(string one) { one = "two"; } main() { string one = "one"; Foo(one);
1
1651
by: ig.martix | last post by:
Is it possible to put a variable in parameter for a URL? I'm looking to have a page with an input box and a link. When someone puts in a value in the input box and clicks the link it will take the value and pass it through the link to an asp page. example: Employee Name <input type="text" name="Tname" size="20"> <a href="emp_info.asp?e_num= Tname.value">Employee Info </a>
4
2377
by: David Sanders | last post by:
Hi, I have a class depending on a template parameter: template<int n> class MyClass { }; I want the template parameter to be chosen according to a variable, e.g.
2
1266
by: GiJeet | last post by:
Hi, just learning extension methods and the first parameter confuses me. I understand using the this keyword to indicate the class we wish to extend, but is the first parameter also used to catch something passed ? Or is is it just to specify the class we wish to extend? the reason I guess I'm confused is because sometimes a see a variable after the class name. TIA Gi
1
1431
by: rsandes1 | last post by:
Hello, still a newbie here, Does anyone know how to use a session variable like "UserId" column as a parameter within a object data source. The options that I have are "querystring", "control", "form", and session etc... How would I setup the session option to use the currently logged in user to my application when configuring my object data source. I get data returned when I enter a hard coded value in the default box of the session...
4
1699
by: gchichester | last post by:
Is there a way to assign the data from and Input box of a parameter query to a variable? Here's the parameter for the query; ((DatePart('ww',,2,2))=)) I would like to assign the "Week Number" the user enters to a variable. Thanks for any and all suggestions Gil
0
9726
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10647
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10395
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9204
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7667
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6887
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5553
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.