|
|
Not with the OOB gridview. You would need a third party component such as Telerik or Infragistics that has the support built in, or derive your own
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi,
I've a datagridview with combobox and checkbox columns and would like to bind the datatable to the gridview. As per the data in datatable the items should get selected in the combobox. Please guide me. Thanks in advance.
|
|
|
|
|
Maybe this post here can help you.
|
|
|
|
|
Hi All,
I am working HTTPWebRequest to access the url and copy the data in other server database.
I am using the Threading concept here.
But the processing of threading is very slow.I am excepting the processing to 120/min but, it giving only 50/min processing.
Can you please help me in this case,how to increase the processing to 120/min.
Thanks in Advance.
JohnDas
|
|
|
|
|
Get a faster connection
Adding more threads does not guarantee increased performance, it can actually slow it do if not done properly.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi,
A colour palette column is required in datagridview. Where the user should have the privilege to select the his own color. Please let me know how to set that column. Thanks in advance
|
|
|
|
|
To create a control that you can host in a cell in editing mode, you can implement the IDataGridViewEditingControl interface in a class derived from Control.
you can find an example in msdn named:
Host Controls in Windows Forms DataGridView Cells
|
|
|
|
|
Hi all,
I have a button click event that is used to write a double used for offsetting another number in a form (ultimately to zero a display). Still struggling as a new user and having problem with an error:
'double WindowsApplication14.frmMain.btnZero_Click(object, System.EventArgs)' has the wrong return type
Here is the function:
private double btnZero_Click(object sender, EventArgs e)
{
dblOffset = dblReceive * -1;
return dblOffset;
}
Can anyone let me know what I'm doing wrong here?
Thanks.
|
|
|
|
|
you cant use return type for click event.
you should use void for click event.
the signature of method that you can use for click event is:
void methodname(object,EventArgs)
|
|
|
|
|
Do you have any suggestion for how I would get around this? Need to look at the current value of a double and then null it by clicking a button labeled "Zero". That is why dblOffset is equal to dblReceive * -1. I want to add dblOffset at that moment to dblReceive, which would then set dblReceive to zero.
Thanks.
|
|
|
|
|
I am having trouble figuring this out... even where to start. Basically I want to mimic the active directory browser. Listing all the OU's and their childs.
The hard part is I'm trying to do this backwards from what most people do I believe. What I have is a list of USERS and their DISTINGUISHEDNAME.
So:
I have a user:
CN=Jacob Dixon,OU=INFO TECH,OU=MAIN DIVISION,DC=company,DC=com
So what I did was:
string[] dn = usr.DistinguishedName.Split(',');
Array.Reverse(dn);
I then loop through each string ignoring EVERYTHING except for strings that start with "OU=". Anyone have an example on how to accomplish this?
I have tried something like this:
TreeNode root = new TreeNode();
TreeNode prev = new TreeNode();
foreach (string s in dn)
{
if (s.Contains("OU="))
{
string tmp = s.Replace("OU=", string.Empty);
if (string.IsNullOrEmpty(root.Text))
{
root.Text = tmp;
}
else
{
if (string.IsNullOrEmpty(prev.Text))
{
prev.Text = tmp;
root.Nodes.Add(prev);
}
else
{
TreeNode n = new TreeNode();
n.Text = tmp;
prev.Nodes.Add(n);
prev = n;
}
}
}
}
tvUsers.Nodes.Add(root);
It does the root and children but it also inserts duplicates.. (I know I'm not checking right now for duplicates). I'm just having a hard time figuring this out..
|
|
|
|
|
Hi,
In one of my tables I have a column with type char(1). When I used LINQ to SQL, this column was correctly mapped to "char" type but when using Entity Framework its being mapped to "String" type as opposed to "char".
Also there isn't seem to be an option in the Type drop down to select "char".
Can anyone shed some light on this matter?
|
|
|
|
|
I created a Windows Service that is installed on a server. Whenever any type of any error is thrown, the error is logged and the service stops.
Is there anyway to setup my try/catch to make sure the service continues to run after the error is logged?
static void Main(string[] args)
{
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.UnhandledException += new UnhandledExceptionEventHandler(currentDomain_UnhandledException);
#if !DEBUG
try
{
#endif
#if DEBUG
isDebugMode = true;
object debug = new object();
MessagingBroker(debug);
#else
ServiceBase.Run(new Program());
#endif
#if !DEBUG
}
catch (Exception e)
{
string msg = "Error: " + e.Source + "\r\n";
msg += "Message: " + e.Message + "\r\n";
msg += "Stack Trace: " + e.StackTrace;
sEvent = e.Source;
LogEvent(msg, EventLogEntryType.Error);
}
#endif
}
Thanks,
Joe Brislin
|
|
|
|
|
That doesn't look like a Windows Service to me.
|
|
|
|
|
It runs as a console application when in debug mode to help with programming and debugging but can also be installed as a Windows service.
|
|
|
|
|
Where is your OnStart method? That's the one you should protect with a try/catch block. Your Main() function is not on the stack when the SCM calls Onstart().
Oh and BTW, what is Program() ? It should be a ServiceBase (Hopefully with some initialization in the constructor) for this code to work.
Note that you don't have to override OnStart, but if you don't your service won't do anything (which is still the best way of not generating errors )
|
|
|
|
|
Michel Godfroid wrote: OnStart
OnStart isn't even the important method.
|
|
|
|
|
No, but it's a start
|
|
|
|
|
Michel,
Thanks for the reply. You get me headed in the right direction. I actually needed to have my try/catch in the Service Method that is called in the OnStart. Everything is working like a charm now. I appreciate the help.
Thanks,
Joe Brislin
|
|
|
|
|
Joe Brislin wrote: try/catch in the Service Method
Exactly. Very good.
|
|
|
|
|
Hey everybody, if somebody can help me with this I'd really appreciate it. I'm currently writing a Ticketmaster esque program, in which we have to have a user log-in and out of the program. Well I have a main form, and a log-in form. The user clicks a linked label on the main form to load up the log-in form. Sign in with their credentials and click the log-in button on the log-in form. I have it reading from and checking an access database file to make sure that they have log-in information and that it is correct. What I need now is to be able to pass the [username] from the database that they use on the login form back to the main form, so that the program can recognize if an administrator logs in. Here is my main form code for the log-in button:
private void lnklblLogIn_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
sp.Stop();
frmLogIn LogIn = new frmLogIn();
LogIn.Show();
}
and here is my log-in form code for the log-in button:
private void btnLogIn_Click(object sender, EventArgs e)
{
OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Users\\John\\Desktop\\Database1.mdb");
OleDbCommand com = new OleDbCommand("SELECT UserName, PassWord FROM Table1",con);
OleDbDataReader reader;
bool permit = false;
try
{
con.Open();
reader = com.ExecuteReader();
while (reader.Read())
{
if (txtUserName.Text == (reader["UserName"].ToString()) && mtxtPassWord.Text == reader["PassWord"].ToString())
{
permit = true;
break;
}
}
con.Close();
}
catch
{
MessageBox.Show("File not able to be read");
return;
}
if (permit != true)
MessageBox.Show("Username or Password are not correct.");
else
{
Close();
}
}
So again my issue is being able to get the username logged in with on the "Log-in" form back to the main form so the main form knows who has logged in. If somebody can help me with this I'd really appreciate it
|
|
|
|
|
why not just add an event to the login form. Call it something like "UserLoggedInSuccessfully".
public class MyEventArgs: EventArgs
{
private string _UserName;
public MyEventArgs(string UserName)
{
_UserName = UserName;
}
public string UserName()
{
return _UserName;
}
}
public delegate void myEventHandler(object sender, MyEventArgs e)
public class LoginForm: Form
{
public Event myEventHandler LoginSuccessful;
...
}
Then, when the login is successful you call:
LoginSuccessful(this, new MyEventArgs(UserName));
and hook it on the main form. When the event is raised on the main form, you can check the username to see who it is.
|
|
|
|
|
For this, the best method is probably to set up a public property (called say UserName) in the log in form and then change your main form code to:
private void lnklblLogIn_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
sp.Stop();
myUserName = "";
frmLogIn LogIn = new frmLogIn();
if (LogIn.ShowDialog() == DialogResult.OK)
{
myUserName = LogIn.UserName;
}
} You may want to take some action (like closedown) if the dialog result is not OK
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
I'm having trouble getting the main form to recognize LogIn.UserName, what could I be missing? I tried making the oleDb stuff public but that won't work.
|
|
|
|