|
there is another ways to do that for example :
System.Collections.ArrayList arr = new System.Collections.ArrayList();
for (int i = 0; i <= 10; i++)
{
arr.Add(i);
}
Console.WriteLine(arr[3]);
I know nothing , I know nothing ...
|
|
|
|
|
If it's always the same object type that's being put in the array list and you're using 2.0 or above, then better to use a generic list List<T> where T is the type of the object i.e. List<string> .
ArrayList involves unboxing/boxing which isn't a great idea.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Noted , Thank you.
I know nothing , I know nothing ...
|
|
|
|
|
Hi there!
I have a client/server program that work properly at the Internet, but with computers that have valid IP. Really I want to make a connection between two computer at the Internet that haven't valid IP, like computers that connect to internet with ISPs, that have a local IP and another IP on Internet (their server IP).
Please see below picture to understand me.
See Here
In the picture, left PC (192.168.20.14) can connect to right ISP (86.110.112.34) easily, but I want to connect to right PC (200.100.114.45). To do this, I think I have to use Port Forwarding technique. Can someone help me please?
Thanks all.
|
|
|
|
|
That is the job of router. You must set port forwarding of your router.
For example, just set port TCP:100 to IP 192.168.20.14.
In that case, if you make a connection to 86.110.112.34:100, it will
be forwarded to 192.168.20.14.
|
|
|
|
|
Thanks a lot.
but I think you mean, "if you make a connection to 92.124.210.110, it will be forwarded to 192.168.20.14".
|
|
|
|
|
"92.124.210.110" <- you don't mention it before.
probably you have a dynamic IP from your ISP.
|
|
|
|
|
I need to use some sort of pointer or other way for a variable to contain the name of another variable, it is a bit difficult to explain but the following (not correct) code will give the idea.
string varName;
string myVar;
myVar = "varName";
&myVar = "Whatever";
Now Variable varName contains "Whatever"
Any ideas or directions ?
Thanks
|
|
|
|
|
You're referring to unsafe code. Yes, you can. It's not recommended because of the potential for memory leaks, but it's possible. You wrap the code using pointers in an unsafe block, like so:
unsafe
{
}
Then you have to coerce VS into compiling it. Project properties->Build->Allow unsafe code
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
Actually re-reading it I see I explained it wrongly.
What I need is an evaluations something like below is often used in scripting languages.
string varName;
string myVar;
myVar = "varName";
eval(myVar) = "Whatever";
Now Variable varName contains "Whatever"
Basically I have an array with 2 columns, 1st column has the variable name and the second has the value.
I do not want to have something like
for(x = 0; x < arrayRows; x++;)
{
if(array[x,0] = "myVar1") {myVar1 = array[x,1]}
if(array[x,0] = "myVar2") {myVar2 = array[x,1]}
..
..
}
I would like something like
for(x = 0; x < arrayRows; x++;)
{
eval(array[x,0]) = array[x,1]}
}
Of course eval does not exist in C#
Any ideas or directions ?
Thanks
|
|
|
|
|
As CG said below, you may want to use a class to store these values, using Reflection (namespace System.Reflection) to get their names and get and set their values dynamically
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
You need to learn some C# basics. You can do this by creating a class to store your variable. And I'm not sure you can do what you want with pointers in C#, C# pointers are pretty limited.
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
Hello everybody,
First of all thanks a lot for all of yours' support on forums, blogs and dev networks with the help of which development becomes very easy and motivating.
I've developed an addin for Outlook 2003 using VSTO SE and VS 2005 (C#). By referring to the articles regarding deployment I was able to manage to create its MSI installer from setup and deployment project in the solution. The addin gets properly installed on other machines having Outlook 2003 and works there fine. All the security policies are granted properly as well. I am using SetSecurity project for granting trust to assemblies. For that I had referred to articles
Deploying Visual Studio 2005 Tools for Office Solutions Using Windows Installer Part 1 & 2 (http://msdn.microsoft.com/en-us/library/aa537173(office.11).aspx) (http://msdn.microsoft.com/en-us/library/aa537179.aspx)
Now I want to deploy the same addin for Windows Vista. I am aware of the issues faced due to UAC. The major issue is regarding admin access to installer and need of presence of registry keys in HKLM when UAC is turned off. In my installer project I can add those additional registry keys in Registry view. Now my questions are (finally ...)
1. I want to know whether it is possible to use a single installer for Windows XP and Windows Vista. If yes, how can I determine OS version in my Custom Actions or Launch Conditions?
2. If answer to previous question is positive then are there any changes required in method of granting trust to assemblies For Windows Vista? I've already stated that I'm using modified version of SetSecurity project for that.
3. How can determine in Windows Vista whether the UAC has been turned on or off? How can I set a registry launch condition for that so that I can register additional keys in HKLM hive. I'm anyways going to add keys in HKCU for both XP as well as Vista.
4. How can I add those registry keys if I find that it's Windows Vista and UAC is turned off?
I've read articles. They say all about where to change in the registry of Windows Vista, but not how to change it.
* Deploying Application Level Addins (http://msdn.microsoft.com/en-us/library/ms269007(VS.80).aspx)
* Deploying Visual Studio 2005 Tools for the Office System SE Solutions Using Windows Installer (Part 1 of 2) (http://msdn.microsoft.com/en-us/library/bb332051.aspx)
* Deploying Visual Studio 2005 Tools for the Office System SE Solutions Using Windows Installer: Walkthroughs (Part 2 of 2) (http://msdn.microsoft.com/en-us/library/bb332052.aspx)
Thanks a lot once again for your appreciation. Awaiting the reply.
regards,
Chaitanya
|
|
|
|
|
Chaitanya Joshi wrote: how can I determine OS version in my Custom Actions or Launch Conditions?
See here[^]
Chaitanya Joshi wrote: How can I add those registry keys if I find that it's Windows Vista and UAC is turned off?
See here[^] ( Also notice where this page is in MSDN (see the location links at the top ), it's in the Windows Installer Documentation. You may find many answers here, like this one, if you just look )
|
|
|
|
|
Thanks Led...
Very precious links.
But word about MSDN links... I was not investigating what registry keys were to be added but where to add them as in which section of VS Setup & Deployment Project by checking the necessary conditions.
Thanks for help though...
|
|
|
|
|
Chaitanya Joshi wrote: which section of VS Setup & Deployment Project
I don't know what that means. Windows Installer has tables, I don't know what "section" means.
|
|
|
|
|
Hi
i have access db as client db and sql server db as web db. all structures of two database is same except PKs, in sql server PK is uniqueidentifier and in access, PK is Text (with 255 max Length).
in client app i want to send some data from client to web(access to sql) via SqlBulkCopy class, to do this, i use this code to transfer data :
this.personsTableAdapter1.Fill(this.testDataSet1.Persons);
DataTable dtImported = this.testDataSet1.Persons.Clone();
dtImported.Columns["PersonID"].DataType = typeof(Guid);
foreach (TestDataSet.PersonsRow row in this.testDataSet1.Persons.Rows)
{
Guid g = new Guid(row.PersonID);
dtImported.Rows.Add(new object[] { g, row.PersonName });
}
System.Data.SqlClient.SqlBulkCopy bc = new System.Data.SqlClient.SqlBulkCopy(Properties.Settings.Default.TestSqlConnectionString);
bc.DestinationTableName = "Persons";
bc.WriteToServer(dtImported);
but at runTime the following error show me in above line of code:
Cannot set column 'PersonID'. The value violates the MaxLength limit of this column.
where does my problem and how to solve it ?
Thanks
|
|
|
|
|
hdv212 wrote: The value violates the MaxLength limit of this column
Doesn't the error message explain the reason.
The length of the PersonID you specified in the Access and SQL Server are different. Infact, SQL Server has lesser size thn that of in the Access.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Hi Manas
yes, hence i change max length from 255 to 16 in DataSet Designer(in visual stduio), but the problem was not solved.
|
|
|
|
|
hdv212 wrote: i change max length from 255 to 16 in DataSet Designer(in visual stduio),
you need to change the size in your SQL Server table
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
i can not change size in sql server table, because it is uniqueidentifier and it's fix size is 16.
|
|
|
|
|
Deleted ( sorry I post a stupid answer )
I know nothing , I know nothing ...
|
|
|
|
|
This is the error I was getting while installing a in-process dll (BHO) setup which is made in Vs2005 using c#
"could not load file or assembly 'Microsoft.mshtml, version=7.0.3300.0,Culture=neutral,PublicKey=b03f5f7f11d50a3a' or one of its dependencies. The System cannot find the file specified."
For this, I googled and found that Microsoft.mshtml should be installed in GAC or should be available in IE installation folder.
I tried the second one, but still the dll doesnot gets injected?
Anyone can suggest something to solve this?
|
|
|
|
|
Is it even a .NET DLL ?
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
Hi,
I have create a simple vbscript called vbscriptSample.vbs
When you double click it, you see the message Hello.
This script is saved in the local machine i.e. c:\work\vbscriptSample.vbs
I can call this script using:
System.Diagnostics.Process.Start(@"c:\work\vbscriptsample.vbs");
Question:
I am developing a .net application to trigger this local script but to run it against a network machine i.e. MachineB
So when you run it from my local machine, then the message Hello appears on the MachineB
I believe this is to do with WMI
So, this is what I have. It does not give an error but the message hello does not appear.
try
{
ManagementPath p = new ManagementPath(@"\\MachineB\root\cimv2:Win32_process");
ManagementClass m = new ManagementClass(p);
m.InvokeMethod("Create", new object[] {@"\\MachineB\c$\work\vbscriptsample.vbs"});
}
catch (ManagementException err)
{
MessageBox.Show("An error occurred while trying to execute the WMI method: " + err.Message);
}
catch (UnauthorizedAccessException unauthorizedErr)
{
MessageBox.Show("Connection error (user name or password might be incorrect): " + unauthorizedErr.Message);
}
Any thoughts please?
Thanks
|
|
|
|