473,503 Members | 1,648 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

issue when converting C#.net code into vb.net

Hi All,

I am facing problem when i am converting C#.net code(Delegate concept)
into vb.net. I am unable to do that . Can someone help me to solve the
problem. I am providing my C#.net code.

==================================my code is :-
======================================
[DataObjectMethod(DataObjectMethodType.Select, false)]
static public List<MembershipUserWrapperGetMembers(bool
returnAllApprovedUsers, bool returnAllNotApprovedUsers,
string usernameToFind, string sortData)
{

List<MembershipUserWrappermemberList = new
List<MembershipUserWrapper>();

// See if we are looking for just one user
if (usernameToFind != null)
{
MembershipUser mu =
Membership.GetUser(usernameToFind);
if (mu != null)
{
MembershipUserWrapper md = new
MembershipUserWrapper(mu);
memberList.Add(md);
}
}
else
{
MembershipUserCollection muc =
Membership.GetAllUsers();
foreach (MembershipUser mu in muc)
{
if ((returnAllApprovedUsers == true &&
mu.IsApproved == true) ||
(returnAllNotApprovedUsers == true &&
mu.IsApproved == false))
{
MembershipUserWrapper md = new
MembershipUserWrapper(mu);
memberList.Add(md);
}
}

if (sortData == null)
{
sortData = "UserName";
}
if (sortData.Length == 0)
{
sortData = "UserName";
}
string sortDataBase = sortData;
string descString = " DESC";
if (sortData.EndsWith(descString))
{
sortDataBase = sortData.Substring(0,
sortData.Length - descString.Length);
}

Comparison<MembershipUserWrappercomparison = null;

switch (sortDataBase)
{
case "UserName":
comparison = new
Comparison<MembershipUserWrapper>(
delegate(MembershipUserWrapper lhs,
MembershipUserWrapper rhs)
{
return
lhs.UserName.CompareTo(rhs.UserName);
}
);
break;
case "Email":
comparison = new
Comparison<MembershipUserWrapper>(
delegate(MembershipUserWrapper lhs,
MembershipUserWrapper rhs)
{
if (lhs.Email == null | rhs.Email ==
null)
{
return 0;
}
else
{
return
lhs.Email.CompareTo(rhs.Email);
}
}
);
break;
case "CreationDate":
comparison = new
Comparison<MembershipUserWrapper>(
delegate(MembershipUserWrapper lhs,
MembershipUserWrapper rhs)
{
return
lhs.CreationDate.CompareTo(rhs.CreationDate);
}
);
break;
case "IsApproved":
comparison = new
Comparison<MembershipUserWrapper>(
delegate(MembershipUserWrapper lhs,
MembershipUserWrapper rhs)
{
return
lhs.IsApproved.CompareTo(rhs.IsApproved);
}
);
break;
case "IsOnline":
comparison = new
Comparison<MembershipUserWrapper>(
delegate(MembershipUserWrapper lhs,
MembershipUserWrapper rhs)
{
return
lhs.IsOnline.CompareTo(rhs.IsOnline);
}
);
break;
case "LastLoginDate":
comparison = new
Comparison<MembershipUserWrapper>(
delegate(MembershipUserWrapper lhs,
MembershipUserWrapper rhs)
{
return
lhs.LastLoginDate.CompareTo(rhs.LastLoginDate);
}
);
break;
default:
comparison = new
Comparison<MembershipUserWrapper>(
delegate(MembershipUserWrapper lhs,
MembershipUserWrapper rhs)
{
return
lhs.UserName.CompareTo(rhs.UserName);
}
);
break;
}

if (sortData.EndsWith("DESC"))
{
memberList.Sort(comparison);
memberList.Reverse();
}
else
{
memberList.Sort(comparison);
}

}

return memberList;

}
====================================C#.net code
end==================================

now i want this part of code into vb.net code , can some one please
provide me the solution.
I had tried writing myself C#.net code into vb.net code but unable to
acheive correct vb.net code.I had used some conversion tool also from
developer fusion site but it is showing error that is some different
kind of error.Please provide me the vb.net code.
it's urgent

Thanks in advance
Dhananjay
Jan 29 '08 #1
2 1025
Hi Dhananjay,

you can try with Lutz Rioeder's Reflector. Download this tool, compile your
code to produce a DLL, load it into Reflector then export it with VB...

Philippe

Jan 29 '08 #2
Hi Dhananjay,

"Dhananjay" <dh**********@yahoo.co.ina écrit dans le message de
news:9a**********************************@d21g2000 prf.googlegroups.com...
On Jan 29, 7:28 pm, "PhilTheGap" <ori...@noemail.noemailwrote:

HI Philippe,

Thanks a lot for reply.
Here in i am providing my both code files , can you please see where
is the problem. I have tried to correct it but it was not
successful.can you please provide me correct complete code. The
problem is same which i mentioned you. It gives error on Anonymous
method(i.e; Delegate concept).In the last reply you told me to change
the signature of method.problem lies in MembershipUserODS file.
Nope ! I didn't send you this message...
please have a look and try to correct the code.Thanks in advance.
Sorry but I don't have the time for your request. Ask a MVP !

Best regards

Feb 4 '08 #3

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

Similar topics

1
1680
by: smith | last post by:
I was recently set to release an app that used very common single instance code and hit the oddest issue. After many hours of full build tests I believe that it is duplicatable. Environment: ...
3
5014
by: Scott | last post by:
I am using DB2 Connect on HP-UX 11i to read data from an AS400 using SQL. DB2 Connect is converting a vertical bar (¦) character to this: ª. Please see the example below. I have tried changing the...
3
1764
by: SalimShahzad | last post by:
DEAR GURUS, CAN ANY ONE CHECK THIS CODE WHEN I RUN ON UNBOUND TEXT BOX IT WORKS 100%, BUT IF I USED ANY BOUND TEXTBOX IT WORKS SOME TIME AND SOME TIME NOT???? AND IN THE TABLE IT IS SET AS DATE,...
5
2493
by: Robert | last post by:
I have a series of web applications (configured as separate applications) on a server. There is a main application at the root and then several virtual directories that are independant...
1
1398
by: smith | last post by:
I was recently set to release an app that used very common single instance code and hit the oddest issue. After many hours of full build tests I believe that it is duplicatable. Environment: ...
2
1411
SamKL
by: SamKL | last post by:
Fairly new at converting over to using non-table layouts, but I've been working at this one particular issue for over 6 hours now with no real perceivable results... The page in question is W3C...
17
2431
by: Jason Doucette | last post by:
I am converting a C-style unit into a C++ class. I have an implementation function that was defined in the .cpp file (so it was hidden from the interface that exists in the .h file). It uses a...
3
1798
by: Dhananjay | last post by:
Hi All, I am facing problem when i am converting C#.net code(Delegate concept) into vb.net. I am unable to do that . Can someone help me to solve the problem. I am providing my C#.net code. ...
7
2095
by: Ahmedhussain | last post by:
Hi, My application creates a thread for the conversion of several strings. I have an eventhandler called app.finished, but unfortunately, it is never called. Can any one tell me why? The code is...
0
7198
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,...
0
7271
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,...
0
7449
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...
0
5570
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,...
1
4998
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...
0
4666
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...
0
3149
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
373
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...

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.