|
Thanks very much Sathish and alexey.
Did the job perfect.
Kind regards
Andy
|
|
|
|
|
Try using function:
DateTime.TryParse
To count difference between dates in days use code:
<br />
DateTime date1 = new DateTime(2000, 10, 10);<br />
DateTime date2 = DateTime.Now;<br />
TimeSpan span = new TimeSpan(date1.Ticks - date2.Ticks);<br />
int daysCount = span.Days;<br />
Best regards, Alexey.
|
|
|
|
|
Hi,
How do I map two different columnstyles to the same column in data table.
I have a table 'XYZ'.It has columns column1,column2,column3.My datagrid's datasource property
is set to default view of 'XYZ'.I hav defined the following objects:-
DataGridTableStyle-- ts1
DataGridColumnStyle-- cs1
DataGridColumnStyle-- cs2
DataGridColumnStyle-- cs3
Using MappingName property of above objects I have mapped ts1 to 'XYZ',cs1 to column1,cs2 to column2,cs3 to column3.
This works but Exception is thrown when I have to bind cs3 to column2 (or) any other column that has been already mapped
to a columnstyle object
Thanks,
Sreeroop
Developer.
|
|
|
|
|
I am a bit puzzled on WHY you would want to bind cs3 to column2, when it is already bound to column 3, however....
The only way I know to do this, is to have multiple TableStyles, and depending on conditions in your program (?), delete the first TableStyle and apply the second.
HTH
WhiteWizard (aka Gandalf)
|
|
|
|
|
Firstly,I would like to map cs3 to column2 instead of column3(even if column2 has been bound to cs2 )and yes, I had mentioned cs3 is bound to column3.
I did try using a second DataGridTableStyle object ts2, then ts2.GridColumnStyles.Add(cs3);
this allows me to map to column2 as it belongs to a different tablestyle ts2,
but Excepton was thrown when i had to bind ts2 to default view of 'XYZ'using MappingName property of ts2 . Finally,ColumnStyle cs3 should be displayed on the grid .
-- modified at 3:18 Friday 5th May, 2006
|
|
|
|
|
I have application in Byte[] array, how to run application from Byte[]?
|
|
|
|
|
Try static method:
Assembly.Load(byte[] data)
Best regards, Alexey.
|
|
|
|
|
Imagine a matrix,
S M L XL<br />
color1 10 20 30 0<br />
color2 4 5 45 50<br />
color3 1 0 4 5
You a sample matrix what i work on. columns are quantity of sizes (some of them may equals to 0 ) . Rows are colors. rows count and columns count are variable. How to save them to data base.
rows are in a table, size are saved on other table. But i couldnt solve how to save values on table. what do you offer to me ?
|
|
|
|
|
Store the sizes in one table, the model in one table, and the quantities in one table.
Size (SizeId int, SizeName varchar)
1, 'S'
2, 'M'
3, 'L'
4, 'XL'
Model (ModelId int, ModelName varchar)
1, 'color1'
2, 'color2'
3, 'color3'
ModelQuantity (ModelId int, SizeId int, Quantity int)
1, 1, 10
1, 2, 20
1, 3, 30
1, 4, 0
2, 1, 4
2, 2, 5
2, 3, 45
2, 4, 50
3, 1, 1
3, 2, 0
3, 3, 4
3, 4, 5
Alternatively, you can choose to not store any record for the quantities that are zero.
---
b { font-weight: normal; }
|
|
|
|
|
i already did so , but i think it is not effective way.
When reports i show these values as a table (using listview object).
But it is hard to populate values in to a listview.
First i read just columns for creating column header
Then i try to read values at ModelQuantity for rows. Care that all color1 values must be at the same row. So after for datareader.read process , i create a listviewitem object.
|
|
|
|
|
It's the best way if you consider possible changes in the future. You can for an example add the size "XXL" without having to change the data model.
If you give up that flexibility, you could store all sizes for a model in a single record, with each quantity in a field. This would make it simpler to get the data, but if you need to add a size it requires changes in the database and in the code.
---
b { font-weight: normal; }
|
|
|
|
|
that is why i ask for (XXL or XS or any other numeric sizes. )
i search for any easier other way but i think there is no possibility
,thank you for reply
|
|
|
|
|
Hi,
I'm making a windows form that dynamicly puts checkboxes in different FlowLayoutPanels. My problem is that when i dont turn on the AutoSize of a checkbox the text of CheckBox is wrapped. But when i turn on the AutoSize the loading of the form takes to long (about 5 seconds). Does someone knows if there is another way to auto size the text of a checkbox?
this is my code that puts the checkboxes on my form.
i have a array that contains the a string array that looks like this:
options[0] = Checbox nr
options[1] = Checkbox text
options[2] = the group index ther are 4 different groups
for(int i=0;i
|
|
|
|
|
I am working on container control that is kind of a menu where you can add buttons (which are just rectantgles with some properties), and I need to have a Vscroll bar.
the problem is that i have to rePaint my control everytime the scroll moves and I don;t know how to set the Maximun value of the scroll bar to make it move in the range i want
Javier Ruiz
|
|
|
|
|
What's wrong with the following line?
dtp_dob.Value = new DateTime(Convert.ToInt32(rrndata.Dob_Year), dtp_dob.Value.Month, dtp_dob.Value.Day);
If I show the datetimepicker value into a MessageBox it gives the correct date, but in the datetimepicker control today's date is shown
(I've also tried the Refresh method after setting the value)
This line works fine:
txtbox_dob.Text = rrndata.Dob_Day + "/" + dtp_dob.Value.Month + "/" + rrndata.Dob_Year;
tnx...
Coulda, woulda, shoulda doesn't matter if you don't.
<marquee>
|
|
|
|
|
That constructor of DateTime expects 3 integers - year, month & day.
You are only converting the first to an integer!
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
Look closely . I take the month and day from the datetimepicker itself. I only change the year.
Secondly, the value of the datetimepicker is set correct, but shown wrongly.
Besides, if I would send a string to the constructor like that I would get an exception.
Coulda, woulda, shoulda doesn't matter if you don't.
<marquee>
|
|
|
|
|
you're welcome
Maybe try giving a bit more info, especially what the value of rrndata.Dob_Year contains.
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
listen, I appreciate your help, but don't blame me if you didn't read the post correctly.
I clearly said in my original post that the value of the datetimepicker is set correctly, but in the GUI the datetimepicker shows today's date. I never overwrite the value later on either.
If you thought my post wasn't clear, my apologies. I thought it was clear and in any case don't loose your temper about such a thing, it isn't worth it .
Coulda, woulda, shoulda doesn't matter if you don't.
<marquee>
|
|
|
|
|
Im not mad about anything, but a quick "thanks for trying to help" would have sufficed.
I have nothing more to add, good luck solving your problem.
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
Thanks for trying to help, and I do mean it.
On second note: I just reread my second post and idd I could have been more friendly, I didn't mean to sound negative. You're reaction was overexagerated however.
Anyway, from my side no hard feelings and maybe another post will be more friendly towards one another.
Coulda, woulda, shoulda doesn't matter if you don't.
<marquee>
|
|
|
|
|
Maybe it isn't leap-year, and the date is 29 of february.
Best regards, Alexey.
|
|
|
|
|
tnx, but the date that comes in, in my test case, is 1/1/1939
[EDIT]And as I said: the value is set correct, it's only shown wrong...[/EDIT]
Coulda, woulda, shoulda doesn't matter if you don't.
<marquee>
-- modified at 6:14 Thursday 4th May, 2006
|
|
|
|
|
hi V!
just want to ask an example value of the DateTimePicker and the Today's date?
i just asked because maybe, the format of your datetimepicker and Today's date is different...
You can set the datetimepicker format but the today's date format gets it on your regional settings.
try to look at this[^] if that's your problem
hope that helps!
microsoc
|
|
|
|
|
hey tnx!
I was looking in that direction, because I noticed idd the format was different.
The second strange thing I saw was the following:
When I press my button, my value gets set, but today's date stays shown
When I than manually choose another date and than press the button, it works!
[EDIT]Damn, the solution that microsoft proposes will not work. The user is not allowed to change regional settings, but multilanguage support is still required . I'm now searching for the short version (=property of dtp) or a masked textbox.[/EDIT]
Coulda, woulda, shoulda doesn't matter if you don't.
<marquee>
-- modified at 2:31 Friday 5th May, 2006
|
|
|
|
|