|
i want a computer shop management project with sql sever connectivity in which we maintain all the hardware as well as other parts information.simply management program like library management and all other management projects.thank u.
|
|
|
|
|
Well congratulations. Do you mean that you want an asset inventory system? If so, you're probably going to have to end up paying for one.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Pete O'Hanlon wrote: Do you mean that you want an asset inventory system?
Sounds like what he's looking for. He ought to just write one himself
|
|
|
|
|
Is it URGENTZ?
Sorry but we folks here will only give away our millions lines of code that we spent months and months of blood and sweat making the suite of software that you wants (free of charge) ONLY if it is "URGENTZ".
|
|
|
|
|
Hi Friends,
How can I handle the call to specific methods based on a string value without comapring the string value using any of the control statements .
The requirement is explained as follows:
I have 3 methods here.
1. CallMethod(String s)
2. ProcessAgencyDataTable()
3. ProcessAuthorityDataTable()
Now, I should be able to call the method ProcessAgencyDataTable() when (s="Agency") for CallMethod(String s) and
ProcessAuthorityDataTable() when (s="Authority") for CallMethod(String s).
I should achieve this without using any of the control statements (like if, if-else, switch etc).
The CallMethod() should be able to call the specific method based on the value of s parameter.
Note: There will be some similarity in the Method names that will be called.
public void CallMethod(String s)<br />
{<br />
switch (s)<br />
{<br />
case "Agency":<br />
ProcessAgencyDataTable();<br />
break;<br />
case "Authority":<br />
ProcessAuthorityDataTable();<br />
break;<br />
default:<br />
break;<br />
}<br />
}<br />
<br />
private void ProcessAgencyDataTable()<br />
{<br />
}<br />
<br />
private void ProcessAuthorityDataTable()<br />
{<br />
}
Thanks for some suggestions.
Subrahmanyam K
|
|
|
|
|
You can build the method name dynamically and use Reflection to call the method.
using System.Reflection;
...
string methodName = String.Format("Process{0}DataTable", s);
Type t = this.GetType();
BindingFlags flags = BindingFlags.NonPublic | BindingFlags.InvokeMethod | BindingFlags.Instance;
t.InvokeMember(methodName, flags , null, this, null);
...
|
|
|
|
|
Hi,
Thanks a ton for your wonderful suggestion.
Regards,
Subrahmanyam K
|
|
|
|
|
This is cool i helped me too. Because i have about 10 methods to load on details on Form load
example
ReturnPersonalDetails
ReturnEducationalDetails
ReturnProfileDetails
ReturnWordDetails
Thanks again
|
|
|
|
|
I don't know what this is for, but it could be that this could be better designed - for example, having separate classes or object instances for operations on each type of table. Then you could say:
agencyDataSource.ProcessTable();
authorityDataSource.ProcessTable();
In either case, you can have a dictionary to store the methods or objects by name:
Dictionary<string, MyDataSourceObject> tableObjs = new Dictionary<string, MyDataSourceObject>();
...
tableObjs["Agency"]=agencyDataSource;
tableObjs["Authority"]=authorityDataSource;
...
tableObjs["Agency"].ProcessTable();
tableObjs["Authority"].ProcessTable();
delegate void EmptyDelegate();
Dictionary<string, EmptyDelegate> methods = new Dictionary<string, EmptyDelegate>();
...
methods["Agency"]=ProcessAgencyDataTable;
methods["Authority"]=ProcessAuthorityDataTable;
...
methods["Agency"]();
methods["Authority"]();
Or you could do it using Reflection like Brady mentioned but it's slower as far as perf.
--Justin
Microsoft MVP, C#
|
|
|
|
|
Thanks Justin,
When looking for the performance, your suggestion would serve better.
I will have to make a trade-off which way best suits for my Application.
Anyway, Thank you once again for your valuable suggestion.
Regards,
Subrahmanyam K
|
|
|
|
|
|
Hi,
I am trying to print a crytal report using my application programaticaly. I want the user to select the printer and number of copies etc from the print dialog box.
please tell me a way to do this i tried with the following method Where i am giving the Num of pages in the coding and the defualt printer prints the report.
But that is not how i want.
Here is my coding
RepStockSalesCatByLoc repstkslscat = new RepStockSalesCatByLoc();
repstkslscat.SetDataSource(dsreportDiv);
repstkslscat.PrintToPrinter(1, false, 1, 2);
Regards
Ruwandi
rkherath
|
|
|
|
|
Try using ReportViewier to print and use
ReportDocument rptDoc = new ReportDocument();
rptDoc.Load(Server.MapPath("ReportName.rpt"));
rptDoc.SetDataSource(yourDataSet);
CrystalReportViewer1.ReportSource = rptDoc;
the ReportViewer has a print button option, set it to true
CrystalReportViewer1.ShowPrintButton = true;
This usually selects all the printers added on that machine
i hope this helps
|
|
|
|
|
Hi,
Thax, but i have to print 112 reports at once using a foreach. This report is a stock and sales for 112 outlets of a supermarket. user wanna print all the reports at once. but he need to select the printer.
any idea!
regards
Ruwandi
rkherath
|
|
|
|
|
There is a property, PrinterName or some such, that you can set the printer name to.
|
|
|
|
|
I am writing a C# console program that needs to read a file from the same directory as the application. I can't use the current directory as that is not the same as the application directory.
Normally I would use Application.ExecutablePath, but console apps don't derive from Application.
Ideas?
|
|
|
|
|
The current directory is NOT the application directory.
If I open a command prompt, change to C:\Windows and run the application C:\MyProg.exe your example will not work. The file 1.log is in C:\, but the current directory is C:\Windows so I will get a file not found exception.
|
|
|
|
|
try this.
static void Main(string[] args)
{
string loc = Assembly.GetCallingAssembly().Location;
string path = Path.GetDirectoryName(loc);
Console.WriteLine(path);
string[] bla = File.ReadAllLines(path + "\\1.log");
foreach (string var in bla)
{
Console.WriteLine(var);
}
}
|
|
|
|
|
System.Reflection.Assembly execAsm = System.Reflection.Assembly.GetExecutingAssembly();
string asmPath = execAsm.CodeBase.Replace("file:///", "").Replace('/', '\\');
MessageBox.Show(asmPath);
|
|
|
|
|
I'd just got to that point, but I'm using :
System.Reflection.Assembly.GetExecutingAssembly().Location
Thanks.
|
|
|
|
|
Application.ExecutablePath works anyway, try it before you discard it.
"We learn more from our mistakes than we do from getting it right the first time."
|
|
|
|
|
That's easy, just use AppDomain.CurrentDomain.BaseDirectory to get the running directory and add to it your console application name and you have a path just like Application.ExecutablePath.
http://stefanprodan.wordpress.com
|
|
|
|
|
Application.ExecutablePath or Environment.CurrentDirectory for your need
Hope this helps...
|
|
|
|
|
hi
i am trying to chage the text of a label,
but the thing is that its not fast
i am setting the text before some function calls but the text is changed after all the functions.
Do you know any effective method to quickly change the text of a label
My small attempt...
|
|
|
|
|
Can you post the code snippet? Also run the application in debug mode to see what happens
|
|
|
|