Forum: C# Nov 17th, 2009 |
| Replies: 3 Views: 356 You have to show us what you got before we can help you |
Forum: C# Nov 17th, 2009 |
| Replies: 3 Views: 443 you need to have an open connection, just as it says, right before you call execute reader call this
if (conn1.State != ConnectionState.Open)
{
conn1.Open();
}
... |
Forum: C# Apr 9th, 2009 |
| Replies: 4 Views: 997 whether it is buttons or textboxes, still the same concept
//form 1
frmKeypad frmKey = new frmKeypad();
frmKey.ShowDialog();
this.btnQuestion.Text = frmKey.SelectedKey;
//form 2 |
Forum: C# Apr 9th, 2009 |
| Replies: 4 Views: 997 here's a link on a small little sample i did for that
http://alleratech.com/blog/post/Sharing-data-between-forms-with-C.aspx |
Forum: C# Apr 8th, 2009 |
| Replies: 3 Views: 300 pretty much the same thing
the important piece being this line
Application.ThreadException += new System.Threading.ThreadExceptionEventHandler (Application_ThreadException);
unless you... |
Forum: C# Apr 8th, 2009 |
| Replies: 3 Views: 300 Not really
Its good practice to handle the exceptions as they occur and decide if you can move on or pass back a specific error message
Here is an example of what you might be looking for... |
Forum: C# Apr 8th, 2009 |
| Replies: 10 Views: 1,150 i should add to this, both really have their place
normally you would use these instance methods when they pertain to particular class, lets says a single point of reference for a connection... |
Forum: C# Apr 8th, 2009 |
| Replies: 10 Views: 1,150 when using this
public static int Result4, Result6 = 0;
public static Assembly DMUAssembly;
there is no need for a singleton, they are static variables |
Forum: C# Apr 8th, 2009 |
| Replies: 10 Views: 1,150 The problem with that would be is that its not a singleton and can exist in multiple classes
private static readonly GlobalVariables TheSingleGlobalVariableInstance = new GlobalVariables();
... |
Forum: C# Apr 8th, 2009 |
| Replies: 10 Views: 1,150 you are mixing static with singleton here
try this way
public class GlobalVariables
{
private static readonly GlobalVariables TheSingleGlobalVariableInstance = new... |
Forum: C# Apr 8th, 2009 |
| Replies: 1 Views: 426 try this
its unclear why you are using string text as a parameter if its not being passed on, but here it is
void delegate textCallback(string text);
public void ThreadProcSafe2(String text)... |
Forum: C# Apr 7th, 2009 |
| Replies: 2 Views: 574 add an extra variable called shown
private bool shown = false;
private void button1_Click(object sender, EventArgs e)
{
firstName = "Tom";
lastName = "Lee"; ... |
Forum: C# Apr 7th, 2009 |
| Replies: 8 Views: 586 its because you are using an untyped list for one, but you didn't have an else statement
if (yourValue == "b")
{
break;
}
else
{
numbers.Add(Convert.ToInt32(yourValue)); |
Forum: C# Apr 7th, 2009 |
| Replies: 13 Views: 1,817 Prices.Add(2.0);
This only appends to your list, this does not so called 'add' or sum them together
for the sum you need to use a foreach or enumerator as you had before, and increment sumValue |
Forum: C# Apr 7th, 2009 |
| Replies: 1 Views: 596 you can compile c from command line, just use the same from c#
the redirectstandardoutput will allow you to get the output that would be displayed as well
Process proc = new Process();... |
Forum: C# Apr 7th, 2009 |
| Replies: 8 Views: 586 you don't always have to use that way, but you can
you could also do something like this
foreach(int num in numbers)
{
Console.WriteLine(" " + num);
} |
Forum: C# Apr 7th, 2009 |
| Replies: 8 Views: 586 this will loop through all the values in your array
IEnumerator basically means you can use it to iterate your data
lets say you have 1, 5, 3, 8 in your array
this will print out
1 5 3 8 |
Forum: C# Mar 19th, 2009 |
| Replies: 4 Views: 591 The exe is the compiled solution, all exes have already been compiled as well
if you are in a winforms app, it needs to be compiled before running it, if you are in asp.net you can set the project... |
Forum: C# Mar 17th, 2009 |
| Replies: 4 Views: 3,316 In the past I have used SharpZipLib
http://www.icsharpcode.net/OpenSource/SharpZipLib/ |
Forum: C# Mar 16th, 2009 |
| Replies: 2 Views: 276 use formatting
//you set your data here
decimal numValue = 20.0000;
//format it here
string num = String.Format("{0:C}", numValue);
this.textbox.Text = num; |
Forum: C# Mar 11th, 2009 |
| Replies: 2 Views: 1,397 System.Diagnostics.Process.Start("calc") |
Forum: C# Mar 10th, 2009 |
| Replies: 5 Views: 1,972 Just to be sure and check all sides of the problem
I noticed:
this.txtStatus.Text + "\r\n" + text;
if its a one line textbox you won't be able to see the output, for testing purposes, try... |
Forum: C# Mar 6th, 2009 |
| Replies: 13 Views: 895 I mean that if you are typing for the control to receive the typed in text, then this event will get caught |
Forum: C# Mar 6th, 2009 |
| Replies: 13 Views: 895 This happens when the control has focus and the user presses a key
I use this here
if (Int32.TryParse(numString, out num))
to check if it was a numeric key that was pressed, if not, it is... |
Forum: C# Mar 6th, 2009 |
| Replies: 13 Views: 895 first add the event for PreviewKeyDown the same way as you did for validating
here is the code i would use inside the event
i'm not always that great at explaining things like this, and... |
Forum: C# Mar 6th, 2009 |
| Replies: 2 Views: 681 of course, the same as you would any other property
public int[] LendMoney
{
get{return lendMoney;}
set{lendMoney = value;}
} |
Forum: C# Mar 5th, 2009 |
| Replies: 13 Views: 895 Yeh that didn't quite work as i thought it would have
What you can do instead is capture previewkeydown
add this to the existing field
"12" + "4"
124
then check 124 to be greater than... |
Forum: C# Mar 5th, 2009 |
| Replies: 13 Views: 895 In the designer click on the events for the numeric control you are trying to catch the events for and double click on validating
Or on the codeside
numericcontrol.Validating += eventnamehere |
Forum: C# Mar 5th, 2009 |
| Replies: 13 Views: 895 Oh i thought you were making your own control
You should be able to catch the validating event and get the value before it has changed back to maximum |
Forum: C# Mar 5th, 2009 |
| Replies: 1 Views: 988 from the ui we get a filepath
string filePath = this.textBoxPath.value;
//We call our class like this from the ui
BusinessLogic logic = new BusinessLogic(filePath);
logic.Load(); |
Forum: C# Mar 5th, 2009 |
| Replies: 13 Views: 895 I would suggest something like that you would want to be an exception rather than event
Create an exception class and do a check before passing the value to the numeric control and throw an... |
Forum: C# Mar 3rd, 2009 |
| Replies: 4 Views: 561 much more clear now, well if you really will have 50000 records at once or a large number of records, i would use the sql bulk insert
here's a link that should get you started in the right... |
Forum: C# Mar 3rd, 2009 |
| Replies: 4 Views: 561 a couple possible options is dependent on how you are accessing your data
if lets say you are looping through ids and running a select on each id, then that is very inefficient as far as the... |
Forum: C# Mar 3rd, 2009 |
| Replies: 3 Views: 474 Read the file into a byte array, pass the byte array to the webservice, assuming thats what you are using, either way though, then save the file back out into the filesystem using a streamreader |
Forum: C# Dec 2nd, 2008 |
| Replies: 28 Views: 1,650 right, then the exception is correct
uri is expected to be a registered prefix, and javascript is not, things are working properly!!! |
Forum: C# Dec 2nd, 2008 |
| Replies: 28 Views: 1,650 lol whoa, i thought you said it was microsoft |
Forum: C# Dec 2nd, 2008 |
| Replies: 28 Views: 1,650 right, but when that throws an exception, what is the linkItem? |
Forum: C# Dec 2nd, 2008 |
| Replies: 28 Views: 1,650 just to be sure we are still at the same place
what is the exact link that is passed in (what is linkItem) |
Forum: C# Dec 2nd, 2008 |
| Replies: 2 Views: 845 agree with lizr, a lot of times to make the code a little cleaner i would make a constant
const string quote = "\"";
string sample = "This is a " + quote + "test" + quote; |
Forum: C# Dec 2nd, 2008 |
| Replies: 28 Views: 1,650 try with httpresponse and httprequest |