|
Hello,
There are a lot of ways to do that (actually it's a very often asked question).
You will olso find articles here on CP about that.
But I think fastest solution is using a static method for example.
public static void IncreaseProgressBar()
{
mystaticinstanceofmyform.myprogressbar.Value = ...;
}
All the best,
Martin
|
|
|
|
|
Thanks
But where i have to call this method.
one project is main from there i m calling other project class method.
the project in presentation layer.
another project in bussiness layer.
if u give information in detail some example or site address.
thanks.
|
|
|
|
|
I have a Windows Form application with a simple GUI that contains a progress bar. Pushing the button 'Start' on my form invokes some other project[ in same solution] classes that carry out a lot of calculations and database access. I want to show the user the progress of the program. The program is actually a loop of database migration that are handled.
My solution contains more the one project.
we have different layer.
Presentation layer.
bussines layer.
My question is: How do I make the progress bar update itself from other layer, when we dont have reference in bussines layer?
Thanks in advance for your help
|
|
|
|
|
I installed Multi SQL(sql 2000 and sql 2005) at home.
I want to get everyone of sql instance's name.
ex:in sql server manager,has a ServerName list
ServerName list:
vs\sql2k
vs\sql05
VS\SQLEXPRESS
"vs" is my computer's name.
I want to get ServerName list.
Thanks for anybody who give me help.
|
|
|
|
|
Please help me anybody!Thanks.
|
|
|
|
|
|
Thanks.
otherwise, I ain't intentional for it that post multiple messages for the same question.
|
|
|
|
|
You waited a whole 36 minutes between initial posting and repeat plea for help. If you need help that fast then I suggest you phone Microsoft support. for a fee they will answer any question on their products.
If you don't want to pay then you are at the whim of people who are giving up their time to help because they like to help, not because they are paid to help.
|
|
|
|
|
oh,sorry. I ain't intentional.
thanks remind.
|
|
|
|
|
Hi,
I have a problem with a datagrid.
I want to add an extra row to it, this works fine by building tablecells and add them to the grid for each entry in the grid.
The extra rows can be edited by the user, but I don't know how I can bind this extra rows to my datagrid, so the changes of the user are recognized by the webform.
can you please help me with my Problem, or is it impossible to add extra rows, that can be edited by a user?
thank you for your help
Peggy
|
|
|
|
|
You do not need to do anything extra. You create a datatable and bind it to datagrid. Allow user to add a row to datagrid. When user says update then you just use SqlCommanBuilder object to perform the insert operation. You can also refer my article http://www.codeproject.com/useritems/DataGridView_manipulation.asp[^]
Jayant D. Kulkarni
Brainbench Certified Software Engineer in C#, ASP.NET, .NET Framework and ADO.NET
|
|
|
|
|
Hello Friends,
I want to know how to use assembly which is registered in GAC(Global Assembly Cache).
I have Created an assembly name dellMe.dll and i have registered it with same name but different
version 1.0.0.0 abd 1.0.0.1. Can i load the any one of the assembly at runtime.
Basically, i want to know how to do this refering of assembly in our C#.Net application.
Any Example will be helpfull.
Thanks In Advance.
Rahul Kulkarni
|
|
|
|
|
You can do it using reflection.
Assembly asm = Assembly.Load("System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
Jayant D. Kulkarni
Brainbench Certified Software Engineer in C#, ASP.NET, .NET Framework and ADO.NET
|
|
|
|
|
For this i have to copy the assembly. Right?
how can i keep different versions of assembly of same name?
Thanks.
Rahul Kulkarni
|
|
|
|
|
If you check the code carefully then you will come to know that System.Data is from GAC only. Now I have .NET 1.1 and .NET 2.0 installed on my machine. Both contains System.Data but with different versions. That is the speciality of GAC. You need to create a strong name and change the version. Then you can copy your assembly in GAC. You do not need to copy it to your application.
Jayant D. Kulkarni
Brainbench Certified Software Engineer in C#, ASP.NET, .NET Framework and ADO.NET
|
|
|
|
|
Thanks ....It works nice.
Thank You Very much
Rahul Kulkarni
|
|
|
|
|
As per you said all working fine.
even we can create instatance of the class of the assembly.
How can we call function of that class. It is not giving intellisense.
what is the solution.?
Rahul Kulkarni.
|
|
|
|
|
Can do like this.
Assembly asm = Assembly.Load("System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
Type[] tps = asm.GetTypes();
foreach (Type tp in tps)
{
if (tp.IsClass)
{
MethodInfo[] methods = tp.GetMethods();
object abc = Activator.CreateInstance(tp);
if (!methods[0].IsStatic)
{
methods[0].Invoke(tp, new object[] { });
}
}
}
Jayant D. Kulkarni
Brainbench Certified Software Engineer in C#, ASP.NET, .NET Framework and ADO.NET
|
|
|
|
|
Here is a sample code that will open a connection to sql server using reflection.
string connString = "Server = localhost; Database = EmployeePortal; User ID = abc; Password = abc; Trusted_Connection = False;";
Assembly asm = Assembly.Load("System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
Type[] tps = asm.GetTypes();
foreach (Type tp in tps)
{
if (tp.IsClass)
{
if (tp.Name == "SqlConnection")
{
Console.WriteLine("Sql connection found...");
}
MethodInfo[] methods = tp.GetMethods();
object abc = null;
try
{
abc = Activator.CreateInstance(tp, connString);
}
catch (Exception ex)
{
}
foreach (MethodInfo method in methods)
{
if (tp.Name == "SqlConnection" && method.Name == "Open")
{
Console.WriteLine(method.Name);
method.Invoke(abc, null);
}
}
}
}
Jayant D. Kulkarni
Brainbench Certified Software Engineer in C#, ASP.NET, .NET Framework and ADO.NET
|
|
|
|
|
Firstly, Thanks.
You helped me alot.
I got the concept you are telling.
On the basis of your example, i tried for messagebox function.
But it is giving me exception "Parameter Missmatch".
I am not getting were do i can function returned value
Rahul Kulkarni
|
|
|
|
|
If you have overloaded methods then you need to check which method you want to execute. Here is the sample code to call MessageBox.Show("Hi").
Assembly winAsm = Assembly.Load("System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
Type[] allTyps = winAsm.GetTypes();
foreach (Type typ in allTyps)
{
if (typ.Name == "MessageBox")
{
Console.WriteLine("MessageBox found...");
MethodInfo[] mtds = typ.GetMethods();
foreach (MethodInfo mtd in mtds)
{
if (mtd.Name == "Show")
{
if (mtd.GetParameters().Length == 1)
{
mtd.Invoke(typ, new object[] { "Hi!!" });
}
}
}
}
}
Jayant D. Kulkarni
Brainbench Certified Software Engineer in C#, ASP.NET, .NET Framework and ADO.NET
|
|
|
|
|
|
Hello! I am developing a GUI and I am having an strange problem. It
should be a very easy thing, but I have been walking around it for a
while. In my Form, I have a picturebox. I want to detect when the
mouse pointer enters the picturebox area WHILE the mouse left button
is pressed.
I have tried mouseenter, mousedown and mousemove events and none of
them are rised when I enter the control area with the mouse pointer
WHILE the left button is clicked!!!
Any ideas?
Thank you very much in advance!
Alvaro
|
|
|
|
|
The event you want to treat is fired only if the none of the mouse buttons are pressed.
To overcome this behaviour, treat the MouseMove event of the form like this:
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
Point pt = pictureBox1.PointToClient(Cursor.Position);
Rectangle rc = pictureBox1.ClientRectangle;
if (rc.Contains(pt))
{
}
}
} where pictureBox1 is your PictureBox object
SkyWalker
|
|
|
|
|
Hi, Skywalker.
I have tried your solution, but this event is only fired when the mouse is moved in the form, outside the controls (I mean, move it around the background), so as soon as I move my mouse in a picturebox, it is not firing.
I am sorry... maybe trying to simplify the problem I haven't shown the correct enviroment. I will try it again:
I have a form with a panel, and in that panel I have 5 pictureboxes. When the user clicks (and hold the mouse button pressed as if he were dragging) into one of these five pictureboxes, I set a "origin" integer var to 1-5. What I want to do is, when the user moves the mouse with that button pressed and pass over one of the other picturbox, set a "target" integer variable with a value between 1 and 5.
The user could, in example set a origin and drag over several of the other pictureboxes updating the "target" var without release the mouse button.
Any ideas or comments would be very appreciated.
Thank you very much in advance!!!
Alvaro
|
|
|
|