|
the transparece color on the form can be used for this if he choses the transparece color to be the same of the button? or this would just make a hole in the form?
(like when you set the transparece color to be white and put a textbox on the form)
the form is really the only control that suport transparece?
I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p)
|
|
|
|
|
Sentenryu wrote: the transparece color on the form can be used for this if he choses the transparece color to be the same of the button? or this would just make a hole in the form?
It would show the button, as the button is not opaque, does it's own drawing, and knows nothing about all the fancy transparencies.
The simple solution is to use a label.
Sentenryu wrote: the form is really the only control that suport transparece?
Traditionally, even the form did not support that. I still do not see any added value in having the option.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
agreed, the only use for transparence in a form is to make that fancy game menus as mass effect have, but even then the usefulness of this is questionable...
I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p)
|
|
|
|
|
What about the Johnny Foreigner button?
|
|
|
|
|
Controls don't support opacity, only forms do.
The only way to make it work is to create your own version of the controls you want and paint them yourself.
Or, use WPF instead of Windows Forms, but if you're not familiar with WPF the learning curve is pretty steep.
|
|
|
|
|
Hi I am creating a FTP library to connect securly on 990 port.
Below is the code
FTPFactory ftp = new FTPFactory();
ftp.setDebug(true);
ftp.setRemoteHost("207.161.116.232");
ftp.setRemotePort(990);
ftp.loginWithoutUser();
string cmd = "AUTH SSL";
ftp.sendCommand(cmd);
It is from the codeproject itself An FTP secure client library for C#[^]
But i get this error in loginWithoutUser function in readreply()
431 Unable to negotiate secure command connection
I tried it by disabling by firewall also but still get this error. Any one knows how to get around this?
|
|
|
|
|
If you've taken the code from the article, you should ideally post this question in the article discussion at the bottom of the article.
|
|
|
|
|
Problem:First C# 2008 app did not find the location of where the executable was located for the second program.
When my company deployed my C# 2008 and 2010 applications to a test server, one of the applications did not use the configuation set for where the executable was suppose to be at? Our network administrator found where the first program thinks the second executable was at.
Thus I am trying to determine why one of the programs did not take the setting it was given.
The location the first program was looking at was at:
c:/server name/share directory name/test/app1.exe.
The only way I can think this location was picked since on a few tries, the location of the executable as was at:
//server name/share directory name/test/app1.exe
Is this accidently? Should I have the network administrator reboot the test server to see if the c:/server name/share directory name/test/app1.exe. location request goes away?
|
|
|
|
|
dcof wrote: Should I have the network administrator reboot the test server Why? You are just guessing here. The first thing to do is to investigate what is wrong with your program.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
I think you need to learn how to debug applications. Deploy debug builds to the servers, and use remote debugging to hook up to the application you think is at fault. Actually step over the code and see what's going on, rather than expecting us to throw random guesses as to what the problem could be. Deploy and pray is not a valid testing strategy.
|
|
|
|
|
Hi Everyone,
I am trying to create a web page that would allow users to create Citirx session for their needs. I was looking for any article or help available within the forum but I ended up hitting a brick wall. could someone guide me to the right article or any help with regrds to this?
Thanks in advance,
Philip
|
|
|
|
|
Arun Philip Reynolds wrote: I am trying to create a web page that would allow users to create Citirx session for their needs.
Doesn't Citrix offer their own (secured) webpage to host the applications if you install their server?
Arun Philip Reynolds wrote: <layer> I was looking for any article or help available within the forum but I ended up hitting a brick wall.
There will not be any articles on the subject; it's not a general request. Your best bet is to hit the Citrix-forums, and see if you can get support from their staff. I have no idea how they integrate the 'ica-files' into the dashboard, and I'm pretty sure that it depends on the logged in user (and his rights) which will be shown. So the real question here would be whether this is at all possible with the current Citrix-environment, or whether they closed that part out of security.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
ok, I Know about Enum.GetValues() , but what i want to know if is possible is to do a foreach through the values of a enum such as i can do the following:
foreach(var value in enum){
list.Add(new SelectListItem(){
Text = value.ToString(),
Value = ((int)value).ToString()
});
}
say that i have the following enum:
enum States{
Running,
Stoped,
Paused
}
the only way to accomplish what i described above is through the use of Enum.GetValues() and Enum.GetNames() ? or there is some syntax sugar?
I'm asking more out of curiosity than anything else
I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p)
|
|
|
|
|
Nope. No syntactic sugar. Since an Enum is not enumerable, you can't just specify the enum type itself. You must get the enum values in an array or other IEnumerable implementor first.
|
|
|
|
|
and the only way to do this and maintain the type of the enum is adding the values manually to the list...
I was thinking of someway to call a method with every possibly constant of a enum, but the only thing i got so far is something like:
foreach(int value in Enum.GetValues(typeof(MyEnum))){
MyEnum e = (MyEnum)value;
...
}
or if you prefer the linq way...
((IEnumerable<int>)Enum.GetValues(typeof(MyEnum))).Select(x => (MyEnum)x);
the only thing i don't understand is why i can't call the Select method directly on the return of Enum.GetValues() , maybe because Array implements the non-generic IEnumerable interface?
I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p)
|
|
|
|
|
Sentenryu wrote: the only thing i don't understand is why i can't call the Select method directly
on the return of Enum.GetValues() , maybe because Array
implements the non-generic IEnumerable interface?
LINQ works on the IQueryable interface, which array's don't support.
Arrays support the following interfaces:
ICloneable, IList, ICollection, IEnumerable, IStructuralComparable and IStructuralEquatable
The .Select extension works on any IEnumerable, including arrays, so I think your .Select example is a bit flawed. I don't know what you're doing, but...
|
|
|
|
|
First of all, i forgot to say thanks for your answer, so Thanks!
In the case i'm just getting a IEnumerable<SelectListItem> with the values of a enum to display as radiobuttons, the actual code (with the excuse of having names in portuguese) is this:
ViewBag.ApetiteOptions = ((IEnumerable<int>)Enum.GetValues(typeof(Apetite))).Select(x => new SelectListItem() {
Text = ((Apetite)x).ToString(),
Value = x.ToString()
});
Visual Studio (2012) gives me an error when I try to use the select method directly on the return type of the
Enum.GetValues() , I guess it's because this method returns a instace of Array (the base class), and not a instance of int[] .
int[] implements IEnumerable<int> , while Array implements IEnumerable , the Select method Expects IEnumerable<TSource> ...
while writting this post, i updated this bit of code to this:
ViewBag.ApetiteOptions = Enum.GetValues(typeof(Apetite)).OfType<int>().Select(x => new SelectListItem() {
Text = ((Apetite)x).ToString(),
Value = x.ToString()
});
I'm a little bit more happy now
I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p)
|
|
|
|
|
|
See my answer below, all your LINQ example is missing is a call to
OfType<States>()
|
|
|
|
|
Dave Kreskowiak wrote: LINQ works on the IQueryable interface, which array's don't support.
No, LINQ to SQL / EF works on IQueryable, most of Linq2Objects works on IEnumerable<t>
|
|
|
|
|
Crap. That's what I get with 4 hours of sleep...
|
|
|
|
|
GetValues() does return an enumerable list of the actual enums, so your original code works with VERY few changes:
foreach(var value in Enum.GetValues(typeof(States))){
list.Add(new SelectListItem(){
Text = value.ToString(),
Value = ((int)value).ToString()
});
}
Live example: http://rextester.com/PWOX45762[^]
You can also use LINQ if you want, but that call to Enum.GetValues() returns an Array, so you neeed to call OfType<states>() to coerce it to a generic IEnumerable<states>
var list = Enum.GetValues(typeof(States))
.OfType<States>()
.Select(i => .... );
Live example: http://rextester.com/TRHMMB31708[^]
|
|
|
|
|
Wow, I always thought it returned a Array containing int's, this will really simplify the things! thanks a lot!
I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p)
|
|
|
|
|
Hi i'm working out my registration using a three tiered architecture and i'm trying to send the random userid which i got from registering in the aspx page to my custom table which i created. Here is the error i get:
Error 1 'DataClass.ConnectionClass' does not contain a definition for 'ProviderUserKey' and no extension method 'ProviderUserKey' accepting a first argument of type 'DataClass.ConnectionClass' could be found (are you missing a using directive or an assembly reference? Does anyone know how to correct it
here is my presentation layer or the UI layer
using System;
using System.Configuration;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.ApplicationServices;
using System.Data;
using System.Data.SqlClient;
using DataClass;
public partial class Account_Register : System.Web.UI.Page
{
ConnectionClass newobj = new ConnectionClass();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void CreateUserButton_Click(object sender, EventArgs e)
{
string F_Name = txtFirstName.Text;
string L_Name = txtLastName.Text;
string Address = txtAddress.Text;
string City = txtCity.Text;
string State = txtState.Text;
string Zip = txtZipCode.Text;
string DOB = txtDOB.Text;
string Phone = txtPhone.Text;
string email = txtEmail.Text;
string User_Name = txtUserName.Text;
string Password = txtPassword.Text;
string PasswordQuestion = txtPasswordQuestion.Text;
string PasswordAnswer = txtPasswordAnswer.Text;
MembershipCreateStatus createStatus;
MembershipUser newUser = Membership.CreateUser(txtUserName.Text, txtPassword.Text, txtEmail.Text, txtPasswordQuestion.Text, txtPasswordAnswer.Text, true, out createStatus);
switch (createStatus)
{
case MembershipCreateStatus.Success:
string UserId = newUser.ProviderUserKey.ToString();
lblCreateAccount.Text = "The user account was successfully created!";
break;
case MembershipCreateStatus.DuplicateUserName:
lblCreateAccount.Text = "There already exists a user with this username.";
break;
case MembershipCreateStatus.DuplicateEmail:
lblCreateAccount.Text = "There already exists a user with this email address.";
break;
case MembershipCreateStatus.InvalidEmail:
lblCreateAccount.Text = "There email address you provided in invalid.";
break;
case MembershipCreateStatus.InvalidAnswer:
lblCreateAccount.Text = "There security answer was invalid.";
break;
case MembershipCreateStatus.InvalidPassword:
lblCreateAccount.Text = "The password you provided is invalid. It must be seven characters long and have at least one non-alphanumeric character.";
break;
default:
lblCreateAccount.Text = "There was an unknown error; the user account was NOT created.";
break;
}
string userid;
if (newUser != null)
{
userid = newobj.ProviderUserKey.ToString();
newobj.Insert(userid, F_Name, L_Name, Address, City, State, Zip, DOB, Phone,
email, User_Name, Password, PasswordQuestion, PasswordAnswer);
}
}
}
Here is my Data Layer
using System;
using System.Data;
using System.Configuration;
using System.Collections.Specialized;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
namespace DataClass
{
public class ConnectionClass
{
string connStr = ConfigurationManager.ConnectionStrings["aspnetdbConnectionString"].ToString();
public ConnectionClass()
{
}
public int Insert (string U_ID, string F_Name, string L_Name, string Address, string City, string State, string Zip, string DOB, string Phone,
string email, string User_Name, string Password, string PasswordQuestion, string PasswordAnswer)
{
SqlConnection con = new SqlConnection(connStr);
con.Open();
SqlCommand cmd = new SqlCommand("user_membership", con);
cmd.CommandType = CommandType.StoredProcedure;
try {
cmd.Parameters.Add("@UserId", SqlDbType.UniqueIdentifier).Value = new Guid(U_ID);
cmd.Parameters.AddWithValue("@F_Name", F_Name);
cmd.Parameters.AddWithValue("@L_Name", L_Name);
cmd.Parameters.AddWithValue("@Address", Address);
cmd.Parameters.AddWithValue("@City", City);
cmd.Parameters.AddWithValue("@State", State);
cmd.Parameters.AddWithValue("@Zip", Zip);
cmd.Parameters.AddWithValue("@DOB", DOB);
cmd.Parameters.AddWithValue("@Phone", Phone);
cmd.Parameters.AddWithValue("@email", email);
cmd.Parameters.AddWithValue("@User_Name", User_Name);
cmd.Parameters.AddWithValue("@Password", Password);
cmd.Parameters.AddWithValue("@PasswordQuestion", PasswordQuestion);
cmd.Parameters.AddWithValue("@PasswordAnswer", PasswordAnswer);
return cmd.ExecuteNonQuery();
}
catch { throw; }
finally
{
con.Dispose();
con.Close();
cmd.Dispose();
}
}
public DataTable Load(string F_Name, string L_Name, string Address, string City, string State, string Zip, string DOB, string Phone,
string email, string User_Name, string Password, string PasswordQuestion, string PasswordAnswer)
{
SqlConnection conn = new SqlConnection(connStr);
SqlCommand cmd = new SqlCommand("user_membership", conn);
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.SelectCommand.CommandType = CommandType.StoredProcedure;
DataSet ds = new DataSet();
try
{
cmd.Parameters.AddWithValue("@F_Name", F_Name);
cmd.Parameters.AddWithValue("@L_Name", L_Name);
cmd.Parameters.AddWithValue("@Address", Address);
cmd.Parameters.AddWithValue("@City", City);
cmd.Parameters.AddWithValue("@State", State);
cmd.Parameters.AddWithValue("@Zip", Zip);
cmd.Parameters.AddWithValue("@DOB", DOB);
cmd.Parameters.AddWithValue("@Phone", Phone);
cmd.Parameters.AddWithValue("@email", email);
cmd.Parameters.AddWithValue("@User_Name", User_Name);
cmd.Parameters.AddWithValue("@Password", Password);
cmd.Parameters.AddWithValue("@PasswordQuestion", PasswordQuestion);
cmd.Parameters.AddWithValue("@PasswordAnswer", PasswordAnswer);
da.Fill(ds);
return ds.Tables[0];
}
catch
{
throw;
}
finally
{
ds.Dispose();
da.Dispose();
conn.Close();
conn.Dispose();
}
}
}
}
|
|
|
|
|
Ahem:
ConnectionClass newobj = new ConnectionClass();
And
userid = newobj.ProviderUserKey.ToString();
Did you mean:
userid = newUser.ProviderUserKey.ToString();
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|