|
How do i increase the size of the panel dynamically at runtime
|
|
|
|
|
Set the Width and Height ?
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Calculate the height of each control contained within the panel using a loop, and set the panel height to that number. Do the same for width if you need to resize the width as well.
|
|
|
|
|
I get string in UTF-8 format, and when I insert this string to DB it's appears as ??????
I know that string are in UTF-16 and I need to convert it to UTF-8.
I search in web to find good example but i don't find.
Someone can post some code or link how to convert simple string to string in UTF-8 ?
this is example of string in UTF-8 that i want to insert to DB.
Str= "œæÆ à â ç é è ê ë î ï ô û ù ü ÿ ";
|
|
|
|
|
Sorry, I'm a little confused by the explanation. Can you put the DataType of the Column from the database table (varchar, nvarchar, char, nchar, etc.)? Also, I'm confused about whether you're taking a UTF-8 string and converting to UTF-16 or vice-versa.
Keep It Simple Stupid! (KISS)
|
|
|
|
|
O.k :
the data type of the column is varchar(500).
And about UTF-16:
I just search in web and found that when I define string Str, the default
Encoding to Str is UTF-16. am I wrong ??
So- the option to change the column data type to Nvarchar is irrelevant
Because we have a big DB, so changing data type will cause to multiple the DB size....
I need to found a way to insert Str= "œæÆ à â ç é è ê ë î ï ô û ù ü ÿ ";
Without to change the data type.
|
|
|
|
|
A string is neither in UTF-8 or UTF-16, a string is just a string. When you encode a string as UTF-8 or UTF-16 you get a byte array. The memory representation for a string happens to be the same as UTF-16, but a string is not the same thing as a byte array.
If you want to store the string encoded as UTF-8 in the database you can't store it in a text field, you would have to use an image field.
I don't think that you really want to store the string as UTF-8, I think that you want to store it as unicode text, i.e. an nvarchar or ntext field.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I'm looking for the way to create a class that can be used like a DataTable. I just want to have the dynamic rows and columns (no need to have AcceptChanges or Rollback or etc).. but that class should be able to bind with DataGrid. Thanks.
|
|
|
|
|
Michael Sync wrote: I'm looking for the way to create a class that can be used like a DataTable. I just want to have the dynamic rows and columns (no need to have AcceptChanges or Rollback or etc).. but that class should be able to bind with DataGrid.
You can try inheriting the DataTable to write one...?
But what's wrong using the DataTable directly... as long as you want to keep it binded with a DataSet..?
Moim Hossain
R&D Project Manager
BlueCielo ECM Solutions BV
|
|
|
|
|
Thanks.
Actually, I'm using Prism (CompositeWPF) version 2 with multi-targeting feature. Once we crate a class, we have to think about how to use in both WPF and Silverlight. DataTable or DataSet or etc is not available in Silverlight. So, I'm thinking to create very small version of DataTable that we can add/remove the column with Columns name. And we want to bind it with DataGird.
|
|
|
|
|
Michael Sync wrote: I'm thinking to create very small version of DataTable that we can add/remove the column with Columns name
Well, in that case, you might need to write a simple and small version of DataTable for ur ViewModel. You can make use of reflector to get more idea about the .net implementation of DataTable.
One suggestion though, if the binding is the only concern, you could actually define any .net enumerable properties ..I guess?
Moim Hossain
R&D Project Manager
BlueCielo ECM Solutions BV
|
|
|
|
|
Yes. I'm thinking to have a class like below.
class MyDataRow{
}
class MyDataColumn{
}
class MyDataTable{
List<MyDataRow> Rows{}
List<MyDataColumn> Columns{}
}
but
1) I'm not sure whether how I can make my class as a binding class.
eg.
VM
public MyDataTable MyData{
set{..
....PropertyChanged(..)....
}
get{..}
}
<DataGrid ItemSource="{Binding MyData}" />
2. How can I know whether new column or row has been added to now??
E.g.
MyDataTable mydata = new MyDataTable();
mydata.Columns.Add(new MyDataColumn() { Name = "A" });
mydata.Columns.Add(new MyDataColumn() { Name = "B" });
mydata.Columns.Add(new MyDataColumn() { Name = "C" });
Thanks in advance.
|
|
|
|
|
|
No. WCF team can give only the list of column that I need to show on the DataGird and the data that I need to populate to the DataGrid.
Thanks.
|
|
|
|
|
I'm sorry, am I missing something? You can get the data and the columns, isn't that what a DataTable defines also. You get the data in an XML format, or even a collection of some sort, and bind it to the grid. I'm just not seeing your problem I guess.
only two letters away from being an asset
|
|
|
|
|
hi,
iam using delegates...
where iam calling delegate from methods(3 methods and returns single value) and the values set by these methods are used in another method.
Now i need to retun 2 values from delegate with two different datatypes...
i used object[] datatype, but unable to retrieve multiple values..
if is possible with what datatype delegate should be declared and how the values can be set and retrieved..
thanks in advance
|
|
|
|
|
For that you need to create a Class with 2 Data Members with appropriate data type. and in the delegate create a object of that class and set both the variable some values and return the Object.
i.e.
you can also use property instead of public variables used in this example.
Class C
{
public int i;
public string s;
}
private C Method1()
{
C c1 = new C();
c1.i = 10;
c1.s = "test";
return c1;
}
|
|
|
|
|
You can create a new class, encapsulating both values and return that. Or read up on the out-parameter.
I are troll
|
|
|
|
|
Well it should work using object[] return value from the delegate, but you may need to cast to the proper type. If your delegate it returning object, but it's actually an object[] that's been boxed, just cast the returned object to object[] like so:
public delegate object ExecuteDelegate(int i, string s);
...
object[] values = (object[])ExecuteDelegate(int i, string s);
In this case you just unbox the object[] from the return value into the propery type. Or, if your delegate is returning object[] they should be accessible right away:
public delegate object[] ExecuteDelegate(int i, string s);
...
object[] values = ExecuteDelegate(int i, string s);
It is sometimes helpful to create a class (as others have suggested) to represent the delegate's result values that have meaningful property names, etc., but it really depends on your situation. I'd say if the result data is complex or the delegate is used in multiple places to create a class for it; otherwise, just stick with object[].
Keep It Simple Stupid! (KISS)
|
|
|
|
|
You can use the out parameter modifier:
void MyCallback(int input, out string output1, out int output2);
|
|
|
|
|
how i can insert date into table in data base
the data type in table is datetime
|
|
|
|
|
|
thanks for this lesson
but my problem still is not solved
i tried to insert datetime like this
system.datetime.now.toshortdate.tostring();
but witout useful
what is the suloation
|
|
|
|
|
I think you don't have to use the ToString()-method because this will store the date as string and not as datetime.
Maybe you could provide your code, so that we can have a look at.
Regards
Sebastian
|
|
|
|
|
If you want to insert current time and you're using SQL Server, you can use GETDATE()[^] function in the SQL statement.
|
|
|
|