473,769 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help needed with converting C# to VB

I need help converting the following code from C# to VB:

int[] selectedIndexPr oducts = ListBoxProducts .GetSelectedInd ices();
string[] selectedProduct s = new string[selectedIndexPr oducts.Length];

int i = 0;
foreach (int var in selectedIndexPr oducts)
{
selectedProduct s[i++] = ListBoxProducts .Items[var].Value;
}

Especially this line is difficult for me to convert:
"selectedProduc ts[i++] = ListBoxProducts .Items[var].Value;"

I'm very grateful for help!

// SE
Oct 23 '08 #1
2 1441
On Oct 23, 2:15*pm, sta...@gmail.co m wrote:
I need help converting the following code from C# to VB:

int[] selectedIndexPr oducts = ListBoxProducts .GetSelectedInd ices();
string[] selectedProduct s = new string[selectedIndexPr oducts.Length];

int i = 0;
foreach (int var in selectedIndexPr oducts)
{
* *selectedProduc ts[i++] = ListBoxProducts .Items[var].Value;

}

Especially this line is difficult for me to convert:
"selectedProduc ts[i++] = ListBoxProducts .Items[var].Value;"

I'm very grateful for help!

// SE
http://www.developerfusion.com/tools.../csharp-to-vb/
http://msdn.microsoft.com/en-us/library/aa691322.aspx

selectedProduct s(i) = ListBoxProducts .Items(var).Val ue
i = i + 1
Oct 23 '08 #2
On 23 Okt, 14:45, Alexey Smirnov <alexey.smir... @gmail.comwrote :
On Oct 23, 2:15*pm, sta...@gmail.co m wrote:


I need help converting the following code from C# to VB:
int[] selectedIndexPr oducts = ListBoxProducts .GetSelectedInd ices();
string[] selectedProduct s = new string[selectedIndexPr oducts.Length];
int i = 0;
foreach (int var in selectedIndexPr oducts)
{
* *selectedProduc ts[i++] = ListBoxProducts .Items[var].Value;
}
Especially this line is difficult for me to convert:
"selectedProduc ts[i++] = ListBoxProducts .Items[var].Value;"
I'm very grateful for help!
// SE

http://www.developerfusion.com/tools.../aa691322.aspx

selectedProduct s(i) = ListBoxProducts .Items(var).Val ue
i = i + 1- Dölj citerad text -

- Visa citerad text -
Thank you very much! You solved my problem!

// SE
Oct 23 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
9340
by: Mark Wilson CPU | last post by:
A colleague has written a prototype program in PHP, using a MySQL database. It's a relatively simple app, with a restricted set of mysql commands used (see below). The MySQL DB is being replaced with an Oracle DB (same schema). My plan 1) globally replace the few mysql commands with intermediate equivalents (such as myDB_connect for mysql_connect) 2) those central functions would then (for now) call the original mysql function to prove...
28
3306
by: stu_gots | last post by:
I have been losing sleep over this puzzle, and I'm convinced my train of thought is heading in the wrong direction. It is difficult to explain my circumstances, so I will present an identical make-believe challenge in order to avoid confusing the issue further. Suppose I was hosting a dinner and I wanted to invite exactly 12 guests from my neighborhood. I'm really picky about that... I have 12 chairs besides my own, and I want them all...
1
3338
by: MSDN Account | last post by:
We have web site that used the IIS ResKit tool MSWC.PermissionChecker to check file permissions. The web site has been upgraded and that upgrade included changing the default server side language from VBScript to C# (*.vbs --> *.cs). Does C# have a native method for doing what MSWC.PermissionChecker used to do? If so has anyone gone through converting the MSWC.PermissionChecker method to C# and would they share what they did? If not...
2
2416
by: Joe Rigley | last post by:
Help Please! I've been tasked with converting a portion of the corporate web site that currently utilizes local user accounts and NTFS via Basic Authentication to access certain files on the web site to an ASP .NET Forms Authentication approach with SQL Server. I'm just getting comfortable with ASP .Net, but strong in Classic ASP.
1
2845
by: john | last post by:
Hello, I am trying to convert a project from vb6 to vb.net. The code is a sample from an sdk for Canon digital camera's. I have gotten most of the issues resolved, but there are some that I am lacking knowledge in. I would appreciate any help give with this. The main errors have to deal with the VarPtr and AddressOf expression. Unfortunetly I do not have much experience with delegates. Below is some of the code. I can produce the entire...
2
1761
anukagni
by: anukagni | last post by:
Hi, iam having an database for that i have created an user manual includes help topics ..I prepared in the word format and i want to covert this to html help . Iam having Ms Html workshop but i found to hard to create any body sugess me to create an html help by converting the word matters too.... needed solution ... thanks in advance.. thanks, anukagni
1
1782
by: danmilkman | last post by:
Hi Y'all Can someone help me convert the next few lines of code from c++ to c#? I've given it a try myself but my program keeps crashing when I use my c# code. I think the difficulty lies in converting the different datatypes. I'm no star in programming C++ and always have had problems with pointers. Help is greatly appreciated. Here's the code: BOOL EXAPI
7
1481
by: Somebody | last post by:
So, what to do? Cast x to a double. I know that :)... I was only including psuedo-code... but the point is: double x = 100; double cx = 300; double ratio = x / cx; // = 0.33333 double newwidth = 300; double newpos = ratio * newwidth; // result = 99, NOT 100 which is what it
7
1582
by: CD Tom | last post by:
I'm trying to port my application to 2007 and am having a problem with the runtime. Here's what I've done and what's happening. I can open and run my .mdb with out any problem even without converting to 2007. I've made some changes to a couple of forms and everything works fine on the developement machine. I've compiled the application and the .mde works great on the developement machine. I then use the 2007 package wizard and add all...
0
9589
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
10211
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
9994
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
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8870
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...
0
6673
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
5298
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
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.