|
In .NET a context appears to me to be a little schizophrenic. They pop up all over the place and seem to represent something slightly different each time. I guess it depends on the context.
I'm not sure if it represents what you have found but this[^] page, also from MSDN, has the clearest explanation I have seen.
Hope it helps.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
I wouldn't let CG touch my Abacus!
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.
|
|
|
|
|
Good find hey, thanks!
BTW, I liked your pun!
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Hi guys,
I am able to access my own outlook calendar but i wanted to know how could I access the shared calendar via C#.
The shared Calendar resides in the Outlook Public Folders. I couldn't find any examples
Could you please help me.
Thanks
|
|
|
|
|
This[^] thread has a solution using Office.Interop.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
I wouldn't let CG touch my Abacus!
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.
|
|
|
|
|
Hi there all !
In my windows form application i add a tollstrip and 4 buttons on it. I also add 4 panels on form on Dock property: Fill. Mayby it's lame question but I want to modify some of this 4 panels and i go in properties and check for example Panel2 - the list of properties of this control is available but on form i still see a panel1, how i can see my panel2, or 3? I just want to add to this panels some buttons etc...
best regards
|
|
|
|
|
If you add several Controls to a Form and give them all DockStyle.Fill, they will overlap and only one at a time will be visible. What you can do is this:
- in Visual Designer click/select one of the Controls or the Form itself;
- now open the properties pane, it will show the properties for that control;
- on the top it also has a ComboBox listing all the Controls of the Form; select the one you want, I expect that suffices to make it visible.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Luc Pattyn wrote: I expect that suffices to make it visible.
Unfortunately not. You have to play silly beggars with the "Bring to front" / "Send to back" buttons to do anything useful (like drop controls on them).
Certainly this is the case in VS2008 - I haven't tried it in VS2010.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
Tried it in VS2008, and you're right.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Nope: it doesn't work like that. When you select "Dock...Fill" the panel covers the entire client area, and will re-size itself to make sure it always does.
If you have multiple controls that are all set to Fill, then tehy are all teh same size, and stacked behind each other. The only way to see them at run time is to make three of them Visible=False and one of them Visible=True
At Design time, they are also stacked up, only you can't make them invisible. The only way I know to select a specific panel is to use the drop down list at the top of the Properties window. Even that won't let you select panel1 and drop controls on it if panel 2 is on top of it. To do that, you will have to select a panel, use the "send to back" button, select a different panel, "send to back" and repeat until you have the panel you wanted.
An easier (and nicer for the user) approach might be to use a TabControl instead, and put each of the panels on separate tabs.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
Thanks for help i did a similar but i take 3 panels and set to dock: fill and I made sure that's not any one panel is child of the other panel... So i set all panels are on Form1. Then if i want to modify some panel i used Format -> Order -> Bring to front then i have access to a panel which i want to modify...
I also type those 3 panels on
visible = false
and
private void toolStripSplitButton2_ButtonClick(object sender, EventArgs e)
{
panel2.Visible = false;
panel3.Visible = false;
panel1.Visible = true;
}
private void toolStripButton1_Click(object sender, EventArgs e)
{
panel2.Visible = true;
panel1.Visible = false;
panel3.Visible = false;
}
private void toolStripButton2_Click(object sender, EventArgs e)
{
panel3.Visible = true;
panel1.Visible = false;
panel2.Visible = false;
}
so it's that good in code? Or should i some change?
|
|
|
|
|
It's clear enough! I would be tempted to have a generic routine which sets them all invisible and then set only the one I want visible though:
private void toolStripSplitButton2_ButtonClick(object sender, EventArgs e)
{
SetVisible(panel1);
}
private void toolStripButton1_Click(object sender, EventArgs e)
{
SetVisible(panel2);
}
private void toolStripButton2_Click(object sender, EventArgs e)
{
SetVisible(panel3);
}
private void SetVisible(Panel p)
{
panel1.Visible = false;
panel2.Visible = false;
panel3.Visible = false;
p.Visible = true;
}
For just three panels, I would be happy enough with that: to go any higher, I would use a loop instead:
private void SetVisible(Panel p)
{
foreach (Control c in Controls)
{
Panel pan = c as Panel;
if (pan != null)
{
pan.Visible = false;
}
}
p.Visible = true;
}
Oh, and I would get rid off your names! Don't use "panel1", "panel2", "tool_stripButton2" etc.: use names that describe what they contain. "panColors" and "panFonts", "tsbSelectColors" and "tsbSelectFonts" help the readability of your code a lot, and that makes it easier to debug and work with.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
ok i rename it all and put thise code :
private void toolStripSplitButton2_ButtonClick(object sender, EventArgs e)
{
SetVisible(panel1);
}
private void toolStripButton1_Click(object sender, EventArgs e)
{
SetVisible(panel2);
}
private void toolStripButton2_Click(object sender, EventArgs e)
{
SetVisible(panel3);
}
private void SetVisible(Panel p)
{
foreach (Control c in Controls)
{
Panel pan = c as Panel;
if (pan != null)
{
pan.Visible = false;
}
}
p.Visible = true;
}
it's more beauty of code... than set all false/true without the intended purpose if the panels will...
P.S It's really uncomfortable to switch between all panels "bring to front"
thx for help !!
|
|
|
|
|
nighttrain1 wrote: P.S It's really uncomfortable to switch between all panels "bring to front
Ain't that the truth! That's partly why I prefer the TabControl approach.
nighttrain1 wrote: thx for help
You're welcome!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
"hehe" thx again
|
|
|
|
|
If you want to add several controls(panels in your case) to the same form and Dock them all as Fill, below is the best solution:
- Add Custom user controls to your Project, each of them containing one of the panels.
- Add these controls to your form and dock them as Fill.
Now if you want to edit one of the panels, simply edit the custom user control you created
|
|
|
|
|
hi all,
i use webBrowser control in windows form application, my problem is when i open the form and in the form_Load write code to put the bodyhtml value of the webBrowser it still not loaded and its be empty,
it means the form load finished before the webBrowser Control finish loading,,
how i can solve this problem, please help me.
thanks all
|
|
|
|
|
web browsers typically work in an asynchronous way as they need an undefined amount of time to fetch and render the requested page; the WebBrowser Control offers several events, including a DocumentCompleted one. For simple pages, that suffices. For more complex situations (frames, multiple images, ...) you will notice it fires more than once, and you need to add code to check WebBrowserDocumentCompletedEventArgs.Url to see what has been loaded, or insert some delay after the first DocumentCompleted to make it probable but not certain everything has finished loading.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Hi guys,
I create a formular in my .js file.I create a mysql databes with navicat 8 editor.I wanna that when i enter my data in the formular and click in the save button,it will be saved in the database.For that,in my .aspx.cs file i have this code:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.Odbc;
public partial class application_Application : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
switch (this.Request ["Action"])
{
case "SaveData":
{
string nom = this.Request ["Name"];
string CIN = this.Request ["CarteIdentité"];
string Mat = this.Request ["Matricule"];
string ConnectionString= "Driver={MySQL ODBC 3.51 Driver};"
+ "Server=localhost;" + "Database="informations";" + " UID=root;" + "PASSWORD=root";
OdbcConnection conn=new OdbcConnection(ConnectionString);
string requete=??????
OdbcCommand ODC=new OdbcCommand(requete,conn);
OdbcDataReader ODR;
conn.Open();
ODR=ODC.ExecuteReader();
ODR.Close();
conn.Close();
}break;
default:{}break;
}
}
}
my problem is how i will write in "string requete= " to send the information to my database table
Ty for u help
|
|
|
|
|
Your query will be look like the following:
string requete="INSERT INTO TableName(Column1, Column2, column3)
VALUES('" + nom +"', '" + CIN + "', '" + Mat +"')";
and then finally
ODR=ODC.ExecuteNonQuery();
Hope this helps
|
|
|
|
|
Hi Umair,
I tried u solution.It runs me an error"informations doesn't exist in the current context",informations is the name of my database"
my mysqlconnexion string is:
string ConnectionString= "Driver={Navicat 8 for MySQL};"
+ "Server=localhost;" + "Database="+informations+";" + " UID=root;" + "PASSWORD=root";
Also the
ODR=ODC.ExecuteNonQuery(); u tell me to add,what is its utility?where can I place it?
ty
|
|
|
|
|
Umair Feroze is correct, but I would strongly recommend you use a parametrised query instead of adding the string together:
string requete="INSERT INTO TableName(Column1, Column2, column3) VALUES(@NOM, @CIN, @MAT)";
...
ODC.Parameters.Add("@NOM", nom);
ODC.Parameters.Add("@CIN", CIN);
ODC.Parameters.Add("@MAT", Mat); Particularly with a web based application, there is a high risk of an deliberate or accidental SQL Injection attack which non-parametrised queries are wide open too.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
Hi Pierre as OriginalGriff suggested you a perfect way to save data in MYSQL i will also suggest you to use Parametrized query against database(MYSQL)
you can take a look there[^] and there[^] to learn how to use parametrized query to prevent SQL Injection Attack.
|
|
|
|
|
Is it possible, without wierd try to open the file and if failed sleep a while then try again or sleep after create event 30 seconds to make sure large file is copied, wait for file copy completion event?
It fires event too soon before the file is completely copied.
Чесноков
|
|
|
|
|
I assume you´re talking about some kind of service on the receiving machine?
For situations like this, I don´t hook into the "creation" event, I use the "rename" event. First copy, then rename -> your watcher sees it
I cannot remember: What did I before google?
|
|
|
|
|
no, I have to catch when large file is copied into the folder, e.g. 0.5-1Gb
Чесноков
|
|
|
|
|