Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > issue when converting C#.net code into vb.net

Reply
Thread Tools

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

 
 
Dhananjay
Guest
Posts: n/a
 
      01-29-2008
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<MembershipUserWrapper> GetMembers(bool
returnAllApprovedUsers, bool returnAllNotApprovedUsers,
string usernameToFind, string sortData)
{

List<MembershipUserWrapper> memberList = 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<MembershipUserWrapper> comparison = 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
converting windows vc++ code into linux kdevelop code gitasoumya@gmail.com C++ 6 03-11-2009 10:48 AM
converting windows vc++ code into linux kdevelop code gitasoumya@gmail.com C++ 1 03-08-2009 12:41 PM
issue converting of std_logic_vectors into integers Andy Luotto VHDL 1 09-12-2008 04:00 PM
issue when converting C#.net code into vb.net Dhananjay ASP .Net 3 02-04-2008 02:55 PM
issue when converting C#.net code into vb.net Dhananjay ASP .Net Web Services 1 01-31-2008 03:47 PM



Advertisments