小编aja*_*n12的帖子

比较if语句中的字符串

试着写一段代码来比较两个字符串.如果其中任何一个等于文本框,则会打开一个新的winform.我知道如何做winform部分.

string CreditCard1 = "Some numbers";

        string CreditCard2 = "Some Numbers";
        string RFIDCard1 = "E00700000330E44C";
        string RFIDCard2 = "E00700000338E539";

        if(CardScan_txtBx = CreditCard1 || RFIDCard1)`
Run Code Online (Sandbox Code Playgroud)

我从MSVS 2010收到错误说:

运营商'||' 不能应用于'string'和'string'类型的操作数

有办法做我想要的吗?

c# winforms

3
推荐指数
1
解决办法
361
查看次数

名称Membership在当前上下文中不存在

我正在尝试编写一个简单的Gui来生成随机密码.我试图使用的代码是:

using System.Web.Security;

Password_txtBx.Text = Membership.GeneratePassword(12, 1);

我收到错误:"当前上下文中不存在名称'Membership'"

我已将代码更改为:

Password_txtBx.Text = System.Web.Security.Membership.GeneratePassword(12, 1);

我得到的错误消息是:"命名空间'System.Web'中不存在类型或命名空间'SecurityMembership'(你是否缺少程序集引用?)"

我在上面两个例子中都引用了System.Web.Security.有什么方法可以解决我的问题吗?

c# winforms

3
推荐指数
1
解决办法
8601
查看次数

标签 统计

c# ×2

winforms ×2