|
This is obviously just experimental code, it's not going to be used for anything ? Because otherwise you'd use real variable names and protect from SQL injection, right ?
Where is the DB that you're browsing to ? What if you look at it in access while your app is open ? I'm thinking it gets overwritten every time you run it in Visual Studio.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi Christian,
I have found my basic mistake. Maybe working for a very long time made me so stupid...
Thanks so much for your reply, I've voted it 5 marks!
Best regards.
|
|
|
|
|
Hi guys, I have been searching alot but unluckily couldn't find anything. What i want is that to show nodes/bars around my custom button control so I can change its size through the mouse. Similiar like any other control when they are selected. Can somebody please help me out.
Thanks
|
|
|
|
|
This is in design mode ? Can't you just size it like any other control ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I want to do scaling for different kinds of custom controls that have their own paint methods. But still am not sure how can i display nodes so i can increase the size when i select the righ side node and move my mouse towards the right side direction. I don' want to type in the Size value.
|
|
|
|
|
When I create a custom control, and place it on a form, I can click on it, and then from there drag it to resize it.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
You are right if I have createad my user control and from the ToolBox Explorer in Visual studio i can drag and drop on my form.cs. I even see the selection box around the userControl. That's exactly what I want to show when i run my applicaion while i click on it. Is there anyway to turn on the designMode of the usercontrol when i run my app
That's how i am creating my userControl
public class Circle:UserControl
{
public Circle()
{
Size =new Size(100,100);
}
protected override void OnPaint(PaintEventArgs e)
{
//drawing circle here
}
}
|
|
|
|
|
OK, I see now. Your question was not clear. If you want the designer code at run time, you need to write the code to do it. Add hotspots, capture mouse clicks, resize your control and store it's size somewhere for when the app loads again
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks for answering, but i am wondering is there any resource or link you can provide it. So atleast i would know how to start. Thanks
|
|
|
|
|
Hi there,
In my project I need to create a control in a form and edit it in a diferent thread, but as you all know, that is not possible because it is not allowed to edit something from another thread.
This way (i'm still learning how to use threads), I'm testing a simple project that will have 3 threads
1º- The Main Form
2º- A Count label that will be counting until 100
3º- A Count label that will be counting until 200
What am I trying to do?
- Create a Command that will receive the MainForm as a parameter (this way I can suspend, resume layouts and add Controls to it)
- Create in the Command constructor the label manually (exacly like the generated code from Designer) and the MethodInvoker. What I tried to do by doing so is to create the label, that I'm going to modify, IN the thread that is going to modify it.
- In the main form event of SHOWN call the constructor of the command and then the execute.
The code is at the end of this post.. i commented the line that crossthreads.
I tried creating the label Counter in the Designer but didn't work, then I tried to work around and do as shown above... but again.. I didn't think about the frmMain.Controls.Add(lblCounter) line that modifies the MainForm (in another Thread).
Well basecaly I'm having this problem for 2 reasons that differ from this article:
- The thread modify a Form/Control or something visual.
- The thread is a background process that counts until 100 (but I could let it count forever and it would never end... thats the problem...)
Anyone can help?
The Complete Command Code:
class UpdateCounterCmd: ICommand
{
private System.Windows.Forms.Label lblCount;
private Form1 frmMain;
private MethodInvoker delInvokeMe;
public UpdateCounterCmd(Form1 formMain)
{
lblCount = new System.Windows.Forms.Label();
frmMain = formMain;
delInvokeMe = new MethodInvoker(Count);
}
public void Execute()
{
delInvokeMe.BeginInvoke(CallBack, null);
}
private void CallBack(IAsyncResult ar)
{
delInvokeMe.EndInvoke(ar);
}
private void Count()
{
frmMain.SuspendLayout();
lblCounter.AutoSize = true;
lblCounter.Location = new System.Drawing.Point(333, 96);
lblCounter.Name = "LabelCount";
lblCounter.Size = new System.Drawing.Size(35, 13);
lblCounter.TabIndex = 0;
lblCounter.Text = "Counting: 0";
lblCounter.Visible = true;
frmMain.Controls.Add(lblCounter);
int i = 0;
for (i = 0; i <= 100; i++)
{
lblCounter.Text = "Counting: " + i.ToString();
frmMain.ResumeLayout(true);
frmMain.PerformLayout();
frmMain.SuspendLayout();
}
}
}
|
|
|
|
|
oscarderooij wrote: but I could let it count forever and it would never end... thats the problem...
Yeah, forever never ends. It might be a problem but you can't change it so learn to deal with it.
led mike
|
|
|
|
|
So you mean that I can't create a "background" thread that does something while the main program do the rest?
But that is not my question...
The question is how to modify a control created in another thread.
My project problem is:
I need to create a grid (Xceed GridControl) from a database query. But the query is HUUUUGEEE
so the program takes a huge amount of time to create the grid.
What I want is to create this grid for the main form in another thread so the main program can keep on going and creating different grids at the same time.
Any ideas?
|
|
|
|
|
oscarderooij wrote: So you mean that I can't create a "background" thread that does something while the main program do the rest?
No, that does not appear to be related in any way to what I said.
oscarderooij wrote: My project problem is:
I need to create a grid (Xceed GridControl) from a database query. But the query is HUUUUGEEE
so the program takes a huge amount of time to create the grid.
Well that certainly raises the question of why you didn't put that in your first post eh?
oscarderooij wrote: What I want is to create this grid for the main form in another thread so the main program can keep on going and creating different grids at the same time.
This is a common problem with junior developers. It's called "jumping to conclusions" and in science it's considered "bad".
The common practice solution to your problem is to implement Paging and possible Virtual Mode. If you use those key words in Google you will find much information on the subject. So a search phrase like: MSDN Grid Paging Virtual
Also the actual class name of the Grid control you are using might work better than "Grid" as a keyword.
led mike
|
|
|
|
|
Hi!
let's assume that the sproc returnes 20 rows.
well, i know that the sproc is going to be executed on the DB but
will Skip and Take do their stuff after the data (20 rows) from the sproc is returned to the application or will linq "do it's magic" and call converted to sql statements Skip and Take on the DB and return only 3 rows to the application?
thanks for any help
life is study!!!
|
|
|
|
|
Seishin# wrote: will linq "do it's magic"
Yes! Exactly! The definition of link in Websters just says "see magic". And if the link magic is not enough it will conjure the C# magic. If that is not enough C# will conjure C++ magic which will conjure C magic if needed which in turn, if needed, will conjure assembly magic.
Whew
led mike
|
|
|
|
|
c'mon.. I'm asking seriously..
by "do it's magic" I meant convert linq query into sql query, connect do DB, execute the query, return data and so on...
life is study!!!
|
|
|
|
|
Websters also says "post to linq forum"
It depends if it's a delayed query or not. If not, then it is done against and in-memory sequence
only two letters away from being an asset
|
|
|
|
|
ok.. who/what's "Websters"?!..
ou.. i didn't see linq mb..
sorry!!
life is study!!!
|
|
|
|
|
I'm using c# Express 2008 but I am having problems positioning forms relative to controls on another form.
I'm trying to get a virtual custom keyboard / keypad form(Form B) to pop up next to a control which is embedded on a different form(Form A) but I read that the control.location or control.left and control.top methods only reference the parent form (Form A) co-ordinates.
Is there a way to get a control position relative to screen resolution so when I create form B i can pass it the left and top values so it appears next to the control?
|
|
|
|
|
|
It does seem like a large overhead to create an MDI form to get the form position next to a control...
|
|
|
|
|
Plz can anyone help me to get a code in c# that create DTD file from a XML file,
I need to transform one XML file into many DTD's that respect the Hierarchical of the XML file.
thanks a lot!
|
|
|
|
|
We can't help you because:
1. You have not specified what your problem is. You will need to show what have you done so far and where are you stuck.
2. You are requesting code while you have to ask. Remember that no one will do and is obliged to do your work so try to be pleasant.
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
How do i create a progressbar for a web browser???
|
|
|
|
|