|
Sorry for putting up the wrong names.
I was trying not to edit the key but the value/Type/Data fields of a key.
|
|
|
|
|
Is is possible to change the position of the help display in a property grid? I don't see a property that allows you to do this. I only see ones that allow you to change the colour, and it's visibility.
Thanks,
Greba
|
|
|
|
|
Check out this[^].
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
I have a dropdownlist that is bound to a recordset. The default selected
item has turned out to be the first record in my table. I need a row that
has value = 0 and text showing "--ALL---".
Regards,
Anuradha
|
|
|
|
|
So insert a row like this after you have databound to the list. Note - you will have to insert this at row 0.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Thanx a ton Pete O'Hanlon! I used it this way and it worked:
DropDownList1.Items.Insert(0, new ListItem("Select", "0"));
Regards,
Anuradha.
|
|
|
|
|
No problem. I'm glad to help - and it's great when the solution is so easy to implement.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Ok, now having solved the problem of setting an initial vale to the drop down list, I am facing a new problem. I am using a RequiredFieldValidator to validate that some value is selected from the dropdownlist. Now,since the initial value is already set, it doesnt show an error message if I click 'Save' button without selecting a value. How do I solve this one now? The logic if I may see, is that I need to check id the value in the dropdownlist has changed after page load. But I am not sure how this can be done.
Can you help me on this one as well, please?
Regards,
Anuradha
|
|
|
|
|
Use a CompareValidator control instead and test whether the value of your DropDownList is not equal to zero.
Although, if a valid selection is always required from this DropDownList, is it necessary to put a dummy item in the list? If you omit this, the user will have made a valid selection by default.
Paul Marfleet
|
|
|
|
|
Thanks Paul, I tried what you said, but the problem was that in a CompareValidator I needed to mention the Control to compare as well as the control to be compared. So I looked out for another option. What I did was i added the following code on page load:
DropDownList1.SelectedItem.Value="";
This nullifies the 0 th row value of the drop down list and allows the req field validator to work.
So assume a custom validator is not req..What say?
Regards,
Anuradha
|
|
|
|
|
Set the ValueToCompare property of your CompareValidator control and not the ControlToCompare property. This will allow you to compare the value of your input control against a literal value.
Paul Marfleet
|
|
|
|
|
As Paul said, you can use a Compare validator or, alternatively, you could use a CustomValidator as well.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
|
any one can tell me the algorithm of barcode algorithm
|
|
|
|
|
As far as i am aware the barcode reader just reads a string much like you could put 12345678 into a keyboard. Its upto you how you query your datastore to match products etc
Dan
|
|
|
|
|
Hi Guys. I need a little advice. I am attempting to write a little reminder for my girlfriend. I orriginaly tried storing the details in a .mdf which worked OK for storing but then I couldn't figure out how to check if the reminder date and time == DateTime.Now. I was then advised here to try using XML which I then tried, considering I didn't know much about XML. This worked fine and the only problem i had with thsi was that when the reminder date and time == DateTime.Now it like opped up 60 message boxes, one for every tick on the timer. I would like to know how I can get it to only pop up one message box or advice on the best way to do this. Thanks in advance.
|
|
|
|
|
You probably need another varible. Something like
bool sentReminder = false;
if (time == datetime.now && !sendreminder)
{
sentReminder = true;
}
if (time != datetime.now)
{
sentReminder = false;
}
Anyway, that is one quick thought on what you could do.
Ben
|
|
|
|
|
I'm sure there are better ways, but this would work.
int intFlag = 0;
if ((date and time == DateTime.Now) && (intFlag == 0))
{
intFlag++;
Show reminder;
}
if (date and time != DateTime.Now)
{
intFlag = 0;
}
-- modified at 16:25 Wednesday 3rd October, 2007
|
|
|
|
|
Thanx mate. I will give this a go. Much appreciated.
|
|
|
|
|
|
Adam, last question. The exmple you provided, is that for using with SQL or with XML? I'm a bit lost at which base to use for storing the information in.
|
|
|
|
|
That was for C#, which i am assuming you are writing your GUI in. The code was just a logic loop so it will only post your reminder once.
I don't personally know XML, but SQL is a great program to store information. There's an excellent article on here about SQL by Matt Newman, it might be useful for your project.
http://www.codeproject.com/cs/database/sql_in_csharp.asp
Oh, and the "data and time" in there would be a string in your app... if your using SQL you may have to use the .TrimEnd( ) Command to get rid of extra spaces at the end of the saved "date and time" to make it work right as SQL fills any un-used room with spaces for you.
I hope that answered your question, if not just message back.
Adam
--Its not broken if it never worked.
|
|
|
|
|
I have created a DLL called uptimelib.dll, which
has one function:
public static string GetUptime()
{
double secs, mins, hours, days, hours2, mins2, secs2;
double ticks = Environment.TickCount;
secs = Math.Floor(ticks / 1000);
mins = Math.Floor(secs / 60);
hours = Math.Floor(mins / 60);
days = Math.Floor(hours / 24);
hours2 = hours - (days * 24);
mins2 = mins - (hours * 60);
secs2 = secs - (mins * 60);
return days + "days, " + hours2 + "hours, " + mins2 + "minutes, " + secs2 + "seconds";
}
The problem is, I want to be able to use this function in other projects, just by importing the dll using DllImport(). Therefore, I have put uptimelib.dll in System32 folder, and imported it into my project:
[DllImport("uptimelib.dll")]
public static extern string GetUptime();
But whenever I try to use the function, it throws an exception saying "Uptimelib.dll does not contain an entry point named GetUptime()". I have checked that everything is spelled correctly, and so on.
How do I fix it?
Thanks in advance.
-- modified at 14:18 Wednesday 3rd October, 2007
Virtual1ty
"Any fool can learn from his own mistakes, but a wise man learns from mistakes of others"
|
|
|
|
|
Incase you didn't know, you can also just add a reference to the DLL, so you don't need to use DLLImport. Then you use the function as though it was with the rest of your source code.
To add a reference, right click the folder 'references' in you project view-thing and click add reference, look for a button that says browse or similar. I use sharpdevelop so if your using something else, its probably slighty different.
As for using DLLImport on your own dll's i have no idea, sorry.
|
|
|
|
|
Yes, I knew that, but I still want this to work as well.
Virtual1ty
"Any fool can learn from his own mistakes, but a wise man learns from mistakes of others"
|
|
|
|