|
These new generic collections are great but do I have to type things like this
Dictionary<DateTime, Dictionary<long, IValueGridCellData>>
over and over again or can I assign another name to the above like c++'s typedef?
|
|
|
|
|
|
|
Thanks mate
|
|
|
|
|
Hi, Can you suggest me any good code generator Wizard for C# which will ask questions about Database and then generate code !! I know there are lots of them available but I am not sure which one is the best as all of them are very expensive, so as I will have to pay, i would like to pay for the best one.
|
|
|
|
|
|
You did not provide me the link to the one you wrote ! If that is free, I can try.
|
|
|
|
|
|
Howdy folks,
I was developing a small db app with C# and ran into a bizarre error. VS told me I was missing curly braces where I was not missing them. I went through and matched up the curly braces several times. What I did notice was when I collapse blocks of code using the gray boxes on the left hand side of the editor that the two braces I got errors on were not aligned correctly with the horizontal gray lines on the left hand of the screen. Not sure if that evens makes sense. The curly braces are fine but it seems that I am getting the errors because of how they match up with the guides on the side of the screen. What can I do to change that? Any ideas? Thanks
paul
|
|
|
|
|
You can post the code segment here, we can see and figure out if really there is missing something.
|
|
|
|
|
Hi,
I tried to use a default value of a parameter in a method like this,
public void myMethod(bool value=false)
{
}
But, I got error saying "Default parameter is not permitted". I was wondering why it is not permitted, then MUST I have to Overload the method with another copy of the method definision ?
|
|
|
|
|
Yes you have to. C# doesn't support default parameters. This[^] FAQ entry explains why.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
thanks Senthil for the article link.
|
|
|
|
|
you could do something like the following;
class ParameterClass
{
public string Name;
public int IDNumber;
public ParameterClass()
{
//set some default values;
//since both fields are public they can
//be overridden if necessary
this.Name = "";
this.IDNumber = 0;
}
}
class OptionalParameters
{
[STAThread]
static void Main(string[] args)
{
//instantiate a parameter class object
//and override the name field
ParameterClass c = new ParameterClass();
c.Name = "Lamont Adams";
optionalObject(c);
//show that the changed ID came back
Console.WriteLine("c.IDNumber={0}",c.IDNumber);
//call the method with only defaults
optionalObject(new ParameterClass());
//pause so we can see the output
Console.ReadLine();
}
public static void optionalObject(ParameterClass arg)
{
//because the parameters received are encapsulated
//in an object, they are all optional but have
//a valid state even if not explicitly set by the caller
Console.WriteLine("arg.Name={0}, arg.IDNumber={1}", arg.Name, arg.IDNumber);
//change one of the field values
arg.IDNumber = 10;
}
}
this way you don't have to have an overload for every single combination of parameters.
hope this helps...
|
|
|
|
|
Thanks ryancrawcour,
Although the code looked Scary to me.
|
|
|
|
|
it really isn't very scary ...
all you're doing is creating an object (class or struct either way) that contains your parameters. you assign your defaults in your parameter object and pass that into your method.
that way you can have one method that has the ability to have default values for a parameter.
run the code sample i sent, step through it and you'll see exactly what it is doing ...
if you still unclear, let me know and i'll explain it for you line by line
ciao
RC
|
|
|
|
|
I am using SQLDMO.DLL for Backup & restore utility in C# application.
Following is the code :
SQLDMO._SQLServer srv = new SQLDMO.SQLServerClass();
srv.Connect("IBM0505d-040","sa","");
SQLDMO.Restore res = new SQLDMO.RestoreClass();
res.Devices = res.Files;
res.Files = this.txtRestorefrom.Text;
res.Database = "abc";
res.ReplaceDatabase = true;
res.SQLRestore(srv);
While running above code it gives following exception :
"[Microsoft][ODBC SQL Server Driver][SQL Server]Database in use. The system administrator must have exclusive use of the database to run the restore operation.\n[Microsoft][ODBC SQL Server Driver][SQL Server]Backup or restore operation terminating abnormally."
Can somebody suggest solution for this.
Thanks,
Jitendra C.
Jitendra C.
|
|
|
|
|
Hi,
I have declared a form instance(form) as an instance variable in a Class, and has been initialized in the Class' constractor.
But during a method calls,
private void Issue_Bill_To_Table(String sRemoteAddress, int nRemotePort, String sData)
{
......
if (........)
{
form.Show();
}
return;
}
The form has shown, but is frozen, what can i do to get around with it?
Thanks alot!
|
|
|
|
|
Set some breakpoints inside the form to figure out what's going on in there.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Does the Issue_Bill_To_Table method call come on a non-UI Thread?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Yeah, Issue_Bill_To_Table is called on a non-UI thread, there are actually few of these thread running.
|
|
|
|
|
Then you must either use ShowDialog to display the form, which makes the form modal, or run a message pump using Application.Run. Basically, a window requires a message pump to process messages and your thread, because it's non-UI, doesn't have one.
void Issue_Bill_To_Table (...)
{
Form f = new AppForm();
Application.Run(f);
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I am working on a project that will store login/pw information and allow the user to assign a name to that login/pw. Then, I want to list the account names for the login/pw info in a drop down box and allow the user to select the account they would like to log into and launch the webpage and auto-login to the page. Is this possible?
I've been looking around and I can launch the website, I am just not sure how I could go about setting focus into the login and password fields and then hitting the submit button.
I am fairly new to C#, I go to college and am studying software development, only been doing C# for a few quarters now but I would really like to be able to develop this application.
Any help would be much appreciated.
Justin
|
|
|
|
|
Hi,
Using Strongly Typed dataset, I would like to refer to a column.
This is what I am doing at present:
//dsEmps is the .xsd
EmpBusRule.EmpService.dsEmps employeeDetailsData;
int intEmployeeIDColumn = employeeDetailsData.Employees.Columns[0].Ordinal;
int intFirstNameOrdinal = employeeDetailsData.Employees.Columns[2].Ordinal;
My intention is to use something like :
int intEmployeeIDColumn = employeeDetailsData.Employees.EmployeeID.Ordinal;
int intEmployeeIDColumn = employeeDetailsData.Employees.FirstName.Ordinal;
If I do this the the compiler error is:
'EmpBusRule.EmpService.dsEmps.EmployeesDataTable' does not contain a definition for 'FirstName'
Thanks
|
|
|
|
|
Can the richtextbox control in c# support mulitple fonts?
For example:
Hello, how are you?
I'm fine, thank you
I know you can set the entire rtb to be specific font but what about small pieces of text inside it?
Can someone point me in the right direction?
Thanks
|
|
|
|