|
Can anyone help please!
I am trying to create a list of labels poulated from one textbox, so when i click the button it passes the code to label 1, then label 2, then label 3 etc. I have included the code for a real simple way of doing it, but i dont want a massive list of "if, else if statements", there must be an easier way. Hopefully this makes sense!
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
label1.Text = "";
label2.Text = "";
}
private void button1_Click(object sender, EventArgs e)
{
if (label1.Text == "")
{
label2.Text = "";
string a = textBox1.Text;
label1.Text = a;
}
else if (label1.Text != "")
{
string a = textBox1.Text;
label2.Text = a;
}
}
}
}
|
|
|
|
|
So basically you want to type some text into a TextBox, and when you click a button it starts at label1 and sets its text, then goes to the next label the next time the button is clicked?
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
yes, but if i only add or click five times, then i only get five labels with populated text.
|
|
|
|
|
Just new up a new label, add it to your forms Controls container, and set its properties as you like them (e.g. get the position and size of the previous label, and use that to set the position of the new one)
|
|
|
|
|
Dave Fitter wrote: I am trying to create a list of labels poulated from one textbox, so when i click the button it passes the code to label 1, then label 2, then label 3 etc. I have included the code for a real simple way of doing it
I didn't get the meeaning of above.
Are you talking abut having a list of Label controls?
Cheers!!
Brij
|
|
|
|
|
I am using the following code to validate date in entered in ASP.NET Textbox using Regular Expression;
<asp:textbox id="TextBox1" runat="server" xmlns:asp="#unknown">
<asp:regularexpressionvalidator id="RegularExpressionValidator1" runat="server" controltovalidate="TextBox1" errormessage="Incorrect format" validationexpression="^(d{0}|(31(?!(Feb|feb|Apr|apr|Jun|jun|Sep|<br mode=" hold=" />sep|Nov|nov)))|((30|29)(?!Feb|feb))|(29(?=Feb|feb(((1[6-9]|[2-9]\<br mode=" xmlns:asp="#unknown">
But its not giving the required output
Guide me pls
|
|
|
|
|
Validate Expression that i used is:
ValidationExpression="^(d{0}|(31(?!(Feb|feb|Apr|apr|Jun|jun|Sep|
sep|Nov|nov)))|((30|29)(?!Feb|feb))|(29(?=Feb|feb(((1[6-9]|[2-9]\
d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00
)))))|(29(?=Feb|feb(((0[48]|[2468][048]|[13579]
[26])|((16|[2468][048]|[3579][26])00)))))|(0?[1-9])|1\d|2[0-8])[/](Jan|jan|feb|Feb|mar|Mar|may|May|apr|Apr|jul|Jul|Jun|jun|Aug|aug|
Oct|oct|Sep|sep|Nov|nov|dec|Dec)[/]((1[6-9]|[2-9]\d)\d{2}|\d{2}|d{0})$"
Date format is dd/mm/yyyy
|
|
|
|
|
Remove the line breaks in the pattern before you paste it in the property in the validation tag.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I dont have any break tag in validation expression.
I am try bit different logic for validate expression. Hope to resolve the problem soon
|
|
|
|
|
There are line breaks in the code that you posted in the forum. If your code doesn't look like that, what does it look like?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi Guffa,
Thanks for your support.
I have almost done with that issue.
I resolved that problem, testing the solution.
Get back to you soon.
Dinker
|
|
|
|
|
Just some quick things I noticed without attempting to completely comprehend the whole thing.
Assuming the expression works for the conditions you expect, it will not work if someone types in FeB or FEb or FEB, etc. You should consider making the expression case-insensitive. That will also let you make the expression smaller since you only need jan|feb|mar|... instead of two expressions per month.
Also, I don't know what you expect d{0} to do, but my understanding is that it would try to match 0 d characters (which doesn't make any sense)
|
|
|
|
|
May I suggest you use an ISO 8601-compliant format?
And a DateTimePicker (or WebForms equivalent).
|
|
|
|
|
I am using the following command in the post-build event for copying the dll from the target dir to the destination
copy $(TargetDir)\*.exe $(SolutionDir)\Bin\$(ConfigurationName)
copy $(TargetDir)\*.exe.config $(SolutionDir)\Bin\$(ConfigurationName)
when i try to compile the project i am getting the following error
"Error 5 The command "copy D:\src_comp\C1\bin\Debug\\*.exe D:\src_comp\\Bin\Debug
copy D:\src_comp\C2\bin\Debug\\*.exe.config D:\src_comp\\Bin\Debug" exited with code 1. CDC"
Can any one tell me what is going wrong here?
|
|
|
|
|
might be the double slash causing a problem
try changing it to
copy $(TargetDir)*.exe ...
|
|
|
|
|
$(TargetDir) is the directory of the primary output file for the build (defined with drive and path). It should includes the trailing backslash '\'.
|
|
|
|
|
I've just checked one of my projects - $(TargetDir) is "c:\projects\project1\" so the trailing backslash is included. You're trying to resolve the address something like "c:\projects\project1\\*.exe" which isn't valid path.
Make the change the OP stated - it should work.
It definitely isn't definatley
|
|
|
|
|
there's a double slash in the error you reported:
Reddy Prakash wrote: "Error 5 The command "copy D:\src_comp\C1\bin\Debug\\*.exe D:\src_comp\\Bin\Debug
|
|
|
|
|
Hi Friends
How to rotate a text in 120 degree using Graphics functions in C#
thanks in advance
-kk.tvm-
|
|
|
|
|
I draw to a bitmap and rotate the bitmap. The rotated text looks better that way.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
|
Try using RotateTransform method.
C isn't that hard: void (*(*f[])())() defines f as an array of unspecified size, of pointers to functions that return pointers to functions that return void
"Always program as if the person who will be maintaining your program is a violent psychopath that knows where you live." - Martin Golding
|
|
|
|
|
Not sure if it is a Sql issue or a syntax error of sorts so here it is.
I have a DataTable with a single column Player Name. It is filled with some 20,000 rows. I need to insert this into a Sql database.
I have a Sql database setup with a table called Unknown, it has 2 columns, an Indentity column ID, and a varchar(50) column Player Name.
I copied the data over one-by-one and it took like 15-30 minutes to do, not I am using SqlBulkCopy. The problem is, it simply isn't working. No error, no warnings, no nothing. I have SQL Profiler open and don't see it even hitting the database. Code is attached, what am I doing wrong?
SqlConnection connection = new SqlConnection(Properties.Settings.Default.TibiaSQLConnection);
connection.Open();
SqlBulkCopy copier = new SqlBulkCopy(connection);
copier.BatchSize = 500;
copier.NotifyAfter = 1000;
copier.SqlRowsCopied += new SqlRowsCopiedEventHandler(copier_SqlRowsCopied);
copier.DestinationTableName = "Unknown";
copier.WriteToServer(dtUnknowns);
copier.Close();
connection.Close();
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
copier.ColumnMappings.Add(sourceCol, DestColumn);
Just a note: I would open the connection right before WriteToServer() method and wrap it in a try block and catch exceptions
|
|
|
|
|
It all is wrapped in a try except. That was just a snippit. Let me try that and see how it works.
Do you have to do that even when both columns have the same name?
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|