473,657 Members | 2,566 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Changing If syntax from VB to C#

I searched hard for some advanced c# combobox code and couldn't find any. I
found some examples in vb.net and I am trying to work the new features into
c#. I am having difficulty with converting a few things, I will start with
an If statement.

In vb the line looks like this:
If _showColumns AndAlso (ea.State And
DrawItemState.C omboBoxEdit) <> DrawItemState.C omboBoxEdit Then

in this example:
_showColumns is bool
ea.State is Forms.DrawItemS tate

What does this vb logic do and how can I accomplish the same thing in c#?

Thanks,
Nathan
Nov 16 '05 #1
1 1305
Nathan,

You would do this:

if (_showColumns && (ea.State & DrawItemState.C omboBoxEdit !=
DrawItemState.C omboBoxEdit))
{
// Do something here.
}

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Nathan Kovac" <na**@tctelco.n et> wrote in message
news:e2******** ******@TK2MSFTN GP12.phx.gbl...
I searched hard for some advanced c# combobox code and couldn't find any.
I
found some examples in vb.net and I am trying to work the new features
into
c#. I am having difficulty with converting a few things, I will start with
an If statement.

In vb the line looks like this:
If _showColumns AndAlso (ea.State And
DrawItemState.C omboBoxEdit) <> DrawItemState.C omboBoxEdit Then

in this example:
_showColumns is bool
ea.State is Forms.DrawItemS tate

What does this vb logic do and how can I accomplish the same thing in c#?

Thanks,
Nathan

Nov 16 '05 #2

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

Similar topics

12
1623
by: Eli Daniel | last post by:
Hi, I'm new to Python. Can you please tell me if the following is possible. My users are using other scripting launguage to write scripts. They are used to write somthing like (keeping it simple) T = 100 do_action ('It cost $T dollars')
31
2686
by: Bo Peng | last post by:
Dear list, I have many dictionaries with the same set of keys and I would like to write a function to calculate something based on these values. For example, I have a = {'x':1, 'y':2} b = {'x':3, 'y':3} def fun(dict):
1
3425
by: Kelly Prendergast | last post by:
Hi there, We have a user name convention here that specifies users in the following way: jane.doe john.smith In order to change a database object I must specify the owner name along with the object name. Does anyone know the proper syntax for doing this with a user name that contains a period? When I put the user name followed by the object name in quotes such as 'jane.doe.tb_test_table',
3
1987
by: Billy | last post by:
Hello, I'm having a problem dynamically changing the color of a table background. I'm not sure exactly how to word this, but I'll give an example. I have a function called greentored(propname) i want to be able to change the following to a different color: document.all.propname.style.visibility
31
5687
by: Arthur Shapiro | last post by:
I'm the webmaster for a recreational organization. As part of one page of the site, I have an HTML "Calendar at a Glance" of the organization's events for the month. It's a simple table of a calendar, 7 across by whatever needed down, and I manually create it each month - not a big deal. Every day I go in and darken the background color of the current day's cell by changing the appropriate <TD> entry to <TD bgcolor="c63800"> and...
1
1295
by: Samridhi Kumar Shukla | last post by:
I am facing technical difficulti in using server connection control because we cannot change the path once fixed .. one way is to edit the code of the form generated code but though it allow to manipulate but again when i open the project one day latter the connection string cn.connection string goes away i have again write this code. is there any way out for this
1
2228
by: Geoff Jones | last post by:
Hi Is it possible to change the type of data a column holds in DataTable at runtime? For example, suppose that the table column originally holds Strings, can we, at runtime, change it to Integers? I'm also interested in changing the date/time that may be held in a column. That is, if the date and time are held in a column of DataTable, how can we change it so it only has the time?
8
3911
by: Bosconian | last post by:
I have two multiple select inputs. Initially the first contains a bunch of items and the second is empty. Using a common method, I move items back and forth by double clicking on them. This portion works perfectly, but I would also like to change the background color of the select element with the current focus. I have defined the following classes: ..selected {
5
2164
by: sparks | last post by:
We have a database with 1600+ records in it. They are linked across 7 tables by an ID type autonumber. Now we want(not I want LOL) to remove the first 1200 records no problem but they also want the ID to be reset to 1,2,3 ... this would mean that record 1234=1 1235=2 With the id being linked across 7 tables with relationships...one to one and some with one to many..can this be done without messing up the links?
10
45196
by: steve | last post by:
Hi All I would like to be able to change the cell borders on certain cells to none at runtime to make a group of cells appear to be merged I have tried the following in the cellformatting event..., to no avail Any ideas Regards
0
8397
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
8310
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
8827
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...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6167
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
5632
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
4158
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
4315
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1957
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.