|
|
You might consider what Masaaki has suggested, however I tried something extremely simple which I believe take a lot of the pain out of it.
Basically add a status bar to your form, then drag a progress bar onto the status bar placing it in the lower left hand corner of the status bar, you do not need to add a panel to the status bar. With the progress bar item selected go to the Anchor property and click on both the Bottom and Left "bars". The text value inside the Anchor property should read "Bottom, Left". Run your app, the progress bar will stay in sync with you form at all times now.
Nick Parker
The greatest lesson in life is to know that even fools are right sometimes. - Winston Churchill
|
|
|
|
|
Hehehehe, Thanks guys.
I think I'll go with the first Idea. It may be a pain in the arse, but once I've done it, I know I'll use it again.
Thanks for the cheats... I'll prolly use those if I'm in a rush
--
Richard
|
|
|
|
|
When i run this program,it says Must declare the variable '@Country'.
What should i do.
string selectSQL = "SELECT CustomerID, CompanyName FROM ustomers WHERE Country = @Country AND City = @City";
OleDbConnection nwindConn = new OleDbConnection("Provider=SQLOLEDB;Data Source=localhost;" +
"Integrated Security=SSPI;Initial Catalog=northwind;");
OleDbDataAdapter custDA = new OleDbDataAdapter();
OleDbCommand selectCMD = new OleDbCommand(selectSQL, nwindConn);
custDA.SelectCommand = selectCMD;
// Add parameters and set values.
selectCMD.Parameters.Add("@Country", OleDbType.VarChar, 15).Value = "UK";
selectCMD.Parameters.Add("@City", OleDbType.VarChar, 15).Value = "London";
DataSet custDS = new DataSet();
custDA.Fill(custDS, "Customers");
|
|
|
|
|
Try setting the two parameters before you set the custDA.SelectCommand.
Paul
Life is just a sexually transmitted desease - Matthew Wright (ex-journalist, TV presenter) 10-Oct-02
I finally have a sig! - Paul Riley (part-time deity) 10-Oct-02
|
|
|
|
|
I tried that also,but no use.
|
|
|
|
|
Okay... next guess:
SELECT CustomerID, CompanyName FROM ustomers...
Are you really trying to select from the "ustomers" table?
Paul
Life is just a sexually transmitted desease - Matthew Wright (ex-journalist, TV presenter) 10-Oct-02
I finally have a sig! - Paul Riley (part-time deity) 10-Oct-02
|
|
|
|
|
Gahhh, I just had a strange flash of inspiration. I'm pretty sure those Parameters.Add("@Variable"... lines shouldn't have the @ symbol in them.
@ in the SQL line defines where the parameters are but is not part of the parameter name.
Paul
Life is just a sexually transmitted desease - Matthew Wright (ex-journalist, TV presenter) 10-Oct-02
I finally have a sig! - Paul Riley (part-time deity) 10-Oct-02
|
|
|
|
|
Paul Riley wrote:
@ in the SQL line defines where the parameters are but is not part of the parameter name.
All the code I have seen do that (add @), I guess maybe it deals with it internally.
Before you criticize a man, walk a mile in his shoes. That way, when you do criticize him, you'll be a mile away and have his shoes.
|
|
|
|
|
Really? Shucks!
In that case I return to my "ustomers" theory
Paul
Life is just a sexually transmitted desease - Matthew Wright (ex-journalist, TV presenter) 10-Oct-02
I finally have a sig! - Paul Riley (part-time deity) 10-Oct-02
|
|
|
|
|
|
Just an idea, but does it matter that the variables are the same name as the fields??
-- LuisR
──────────────
Luis Alonso Ramos
Chihuahua, Mexico
www.luisalonsoramos.com
"Do not worry about your difficulties in mathematics, I assure you that mine are greater." -- Albert Einstein
|
|
|
|
|
OK I think I might have the answer for you
string selectSQL = "SELECT CustomerID, CompanyName FROM Customers WHERE (Country = @Country) AND (City = @City)";
suresh_sathya wrote:
When i run this program,it says Must declare the variable '@Country'.
string country = "UK";
string city = "London";
selectCMD.Parameters.Add("@Country", OleDbType.VarChar, 15).Value = country;
selectCMD.Parameters.Add("@City", OleDbType.VarChar, 15).Value = city;
Try that too
Hope it helps!
Before you criticize a man, walk a mile in his shoes. That way, when you do criticize him, you'll be a mile away and have his shoes.
|
|
|
|
|
im using regular expressions for something, but i have found a situation where i will need to search for the * character, which has a meaning in the regex, what should i do?
1001111111011101111100111100101011110011110100101110010011010010 Sonork | 100.21142 | TheEclypse
|
|
|
|
|
Use the escape character \
A note from MSDN:
Note If you are using C++, C#, or JScript, special escaped characters, such as \s, must be preceded by an additional backslash (for example, "\\s2000") to signal that the backslash in the escaped character is a literal character. Otherwise, the regular expression engine treats the backslash and the s in \s as two separate operators. You do not have to add the backslash if you are using Visual Basic .NET. If you are using C#, you can use C# literal strings, which are prefixed with @ and disable escaping. For example, @"\s2000"
My latest articles:
XOR tricks for RAID data protection
Win32 process suspend/resume tool
|
|
|
|
|
thanx
1001111111011101111100111100101011110011110100101110010011010010 Sonork | 100.21142 | TheEclypse
|
|
|
|
|
I know that you already found the solution, but you should get Eric Gunnerson's RegEx Workbench app from GotDotNet. It's really useful. And of course, you have the code so you can change anything you don't like...
http://www.gotdotnet.com/userarea/filedetails.aspx?FileName=regexworkbench.zip[^]
Norm Almond: I seen some GUI's in my life but WTF is this mess
Leppie: I made an app for my sister and she wouldnt use it till it was colorful enough
Norm:good point leppie, from that statement I can only deduce that this GUI must be aimed at children
Leppie:My sister is 25
-Norm on the MailMagic GUI
|
|
|
|
|
And if you find something you don't like, please let me know so I can consider adding it...
|
|
|
|
|
You asked for it...
Just kidding. The only thing I didn't like was when I clicked the button in the top left, the context menu appeared way away from the mouse, in the textbox. So I just changed the parent of the context menu to the button instead. Less mouse travelling that way...
Norm Almond: I seen some GUI's in my life but WTF is this mess
Leppie: I made an app for my sister and she wouldnt use it till it was colorful enough
Norm:good point leppie, from that statement I can only deduce that this GUI must be aimed at children
Leppie:My sister is 25
-Norm on the MailMagic GUI
|
|
|
|
|
Hi,
I have problem with email messages.
I have downloaded email header and I'm trying to get subject of this message.
If there are only english characters, everything is ok
"Subject: emailsubject"
But when I use other characters (I live in Czech Republic ) it looks like this:
"Subject: =?iso-8859-2?Q?Email=20message=20with=20=BE=F8=E8?="
So I want to convert this " " to .Net string (UNICODE)
Thank You
PS: I have seen some code for this on CP http://www.codeproject.com/string/ammimeutils.asp[^], but it doesn't works with other codepages (I think)
|
|
|
|
|
Have you tried looking at System.Text.Encoding.Default ? That will return an Encoding for your default windows codepage.
Dunno if it will work that Good luck
Before you criticize a man, walk a mile in his shoes. That way, when you do criticize him, you'll be a mile away and have his shoes.
|
|
|
|
|
Problem with -> ASP.NET using C#
I am creating a custom user control that reads an xml file and dynamically places labels on the control. This user control will then be placed inside a webform
I am suddenly stuck because I know if I wanted to add dynamically generated controls without a custom user control, which I probably may end up doing if this does not work, I could easily just add this under OnInit function (which is generated by the forms designer.
override protected void OnInit(EventArgs e)
{
// Create dynamic controls here.
// Use "using System.Web.UI.WebControls;"
TextBox1 = new TextBox();
TextBox1.ID = "TextBox1";
TextBox1.Style["Position"] = "Absolute";
TextBox1.Style["Top"] = "25px";
TextBox1.Style["Left"] = "100px";
Form1.Controls.Add(TextBox1);
}
yeah thats from this Q Article.
Thats all fine and good, but you see this line:
Form1.Controls.Add(TextBox1);
What would be the equivalent in a custom User control.
Say my Control is called MyControl.ascx
in my function that reads the xml file and attempts to programatically create a label, every thing is just peachy..but how do I place the label inside my custom control?
I cannot do this:
MyControl somecontrol = new MyControl();
and then in the function do
somecontrol.Contols.Add(myLabel)
wont work!
Cannot create instance of Abstract class or interface? Bah!
I guess I will do it directly from the WebForm, but I just thought there was tremendous coolness value to get it working through a custom control that I could add to a webform without cluttering the webform with all this.
Oh well...if anyone has comments about creating an instance of an abstract class please post!
|
|
|
|
|
You can't create an instance of an abstract class because an abstract class has no implementation, just a list of virtual functions. You can't create an instance of an interface because it's just a list of function definitions (a contract for any inheriting class).
Is MyControl really abstract or have you just put the keyword abstract on it?
Paul
|
|
|
|
|
Paul Riley wrote:
You can't create an instance of an abstract class because an abstract class has no implementation, just a list of virtual functions. You can't create an instance of an interface because it's just a list of function definitions (a contract for any inheriting class).
That explained all I needed to know! MyControl is really abstract, I am @ home now, I will post the code when I get to work..
Thanks!
|
|
|
|
|
public abstract class MyControl : System.Web.UI.UserControl
{
public int countoftext = 0;
public string myType;
public string labelname = "";
public Label mylabel;
public int positiontop = 25;
public int positionleft = 100;
public MyControl tempcontrol = new MyControl();
private void Page_Load(object sender, System.EventArgs e)
{
}
private void ReadMenu()
{
XmlTextReader xmlreader = new XmlTextReader("menu.xml");
while (xmlreader.Read())
{
myType = xmlreader.NodeType.ToString();
if (myType.Equals("Text"))
{
countoftext++;
mylabel = new Label();
mylabel.Text = xmlreader.Value;
mylabel.Style["Position"]="Absolute";
mylabel.Style["Top"] = "" + positiontop +"px";
mylabel.Style["Left"] = "" + positionleft + "px";
tempcontrol.Controls.Add(mylabel);<--WONT WORK
}
}
positiontop = positiontop + 20;
xmlreader.MoveToNextAttribute();
}
I guess I wont use a user control and just do it directly from the form. Oh, and some of the code may seen wrong, I am still learning C#, the code actually does work though, because I was able to display other properties without creating labels on the WebForm1.aspx that was using the custom user control, like showing the Encoding of elements in my xml file, or the count, etc blah ..
|
|
|
|