|
I'm trying to create a subclass of Slider which slide from one color to the next and has a gradient brush background.
The C# code has 2 new properties: StartColor, EndColor
The XAML code is the following:
==================
<Slider x:Class="TransparencySlider.ColorSlider"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Name="root">
<Slider.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
<GradientStop Color="{Binding StartColor, ElementName=root}" Offset="0.0"/>
<GradientStop Color="{Binding EndColor, ElementName=root}" Offset="1.0" />
</LinearGradientBrush>
</Slider.Background>
</Slider>
==================
however at runtime the gradient brush is all white and the log message (in the output windows) is: "cannot find source element for the binding", i.e. cannot find 'root', this slider, the control itself.
mmhh... why is that?
what should I write?
I'm running into a wall......
|
|
|
|
|
I am creating a website through code.
I want to set its framework version to 2.0 by default.
Any idea how to do it?
Please F1.
Nana
|
|
|
|
|
Open Internet Information Services
Right Click on the particular Virtual directory
Select Properties
Select ASP.NET tab
There you can find ASP.NET Version in a list. Select your version and apply it.
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
Hi,
i have a problem concerning float values.
I receive a 4 Byte value through the serial port in the following order:
SEEEEEEE EMMMMMMM MMMMMMMM MMMMMMMM
S - Sign
E - Exponent
M - Mantissa
so, for example i have:
43h 89h 80h 00h (h...hexadecimal)
which is the decimal value of: 275.0
My question is, if anybody knows a way of converting the 4 Byte value to the float value.
Thanks in advance for any help you can provide
|
|
|
|
|
In C++, you would write
number = (sign ? -1:1) * 2^(exponent) * 1.(mantissa bits)
|
|
|
|
|
Actually, with C++ you can be more extreme, for instance:
unsigned char myBytes[4]={0x43, 0x89, 0x80, 0x00};
unsigned char myReversedBytes[4];
myReversedBytes[0] = myBytes[3];
myReversedBytes[1] = myBytes[2];
myReversedBytes[2] = myBytes[1];
myReversedBytes[3] = myBytes[0];
float f = *(float *)myReversedBytes;
Note that if you're lucky the original bytes have not to be reversed.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Use the BitConverter.ToSingle method.
---
single minded; short sighted; long gone;
|
|
|
|
|
Thanks a lot.
This really helped me. I almost thought i would have to code it on my own.
|
|
|
|
|
Note that, If you intend to use the Guffa solution (that indeed is the correct one), then you have to reverse the order of the bytes to get the correct result.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Thanks,
you guys are a real good source for advice.
No wonder that there are lots of people asking anyone of you instead of looking in the msdn documents.
|
|
|
|
|
Sounds like you need a union .
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
Vikram A Punathambekar wrote: Sounds like you need a union.
AFAIK C# doesn't provide it.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
[bangs head against wall]
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
Stored Procedure Code
ALTER PROCEDURE sp_IsValidLogon
@UserName varchar(16),
@Password varchar(16)
As
if exists(Select * From User_Table
Where UserName = @UserName
And
Password = @Password)
begin
return(1)
end
else
begin
INSERT INTO FailedLogons(UserName, Password)
values(@UserName, @Password)
return(0)
end
Go
How can i receive this return value in C#. Kindly, if any1 can give the code for it.
|
|
|
|
|
why are you not using output parameters in your stored procedure so that you cann access those values in c#
Gautham
|
|
|
|
|
I have wriiten the following code but not receiving the value, if u can kindly give me the code to receive the value from the ssotred procedure
SqlCommand("IsValidLogin",conn2);
cmd2.CommandType=CommandType.StoredProcedure;
cmd2.Parameters.Add(new SqlParameter("@userid",SqlDbType.NVarChar,50,"UserId"));
cmd2.Parameters.Add(new SqlParameter("@password",SqlDbType.NVarChar,50,"Password"));
cmd2.Parameters[0].Value=textBox1.Text;
cmd2.Parameters[1].Value=textBox2.Text;
i=cmd2.ExecuteNonQuery();
|
|
|
|
|
hi,
the code below is a modification of your code. it should work.
SqlCommand("IsValidLogin",conn2);
cmd2.CommandType=CommandType.StoredProcedure;
cmd2.Parameters.Add(new SqlParameter("@userid",SqlDbType.NVarChar,50,"UserId"));
cmd2.Parameters.Add(new SqlParameter("@password",SqlDbType.NVarChar,50,"Password"));
cmd2.Parameters[0].Value=textBox1.Text;
cmd2.Parameters[1].Value=textBox2.Text;
SqlParameter param = cmd.Parameters.Add("@retVal",SqlDbType.Int);<br />
param.Direction=ParameterDirection.Output;
i=cmd2.ExecuteNonQuery();
int retVal = cmd.Parameters["@retVal"].Value;
hope this helps
regards
|
|
|
|
|
it is not working bro.. there is an exception that too many parameters specified the stored procedure is taking only two values....how can we add the third one.. i just want to receive the return value whether it is 1 or it is 0 i just need to know how to receive it in my c# code.
|
|
|
|
|
hi again,
since you added a new parameter @retVal as output, you need to change the store procedure as well.
eg.
create proc sp_IsValidLogon<br />
(<br />
@UserName varchar(16),<br />
@Password varchar(16),<br />
@retVal bit --since you want only 0 or 1. this will store the return value<br />
As<br />
begin<br />
.........<br />
--continue with you proc<br />
set @retVal=1 --if you want 1, or else 0<br />
end
NOTE: if you use bit then change the parameter data type from int to bit in your source code.
hope this helps.
regards
|
|
|
|
|
Hi,Im new to C#,I would like to send a sms to a mobile from my C# application.Can any one help me by giving sample code...Thank You in advance..
Hi,Im Razana
|
|
|
|
|
|
I would like to know if is possible and if yes how to create an additional button on the title bar. (A forth button on the title bar)
like some programs have a Minimize to Tray, or for anything else.
<big>Example of the title bar: "." _ [] X</big>
This is not code :doh:
well in C#
Thank You
|
|
|
|
|
Yes it is possible, have a look at this article[^]
Tarakeshwar Reddy
MCP, CCIE Q(R&S)
There are two kinds of people, those who do the work and those who take the credit. Try to be in the first group; there is less competition there. - Indira Gandhi
|
|
|
|
|
Thanks,
But is there a way that supports Visual Styles
or you have to create an image for the main themes(3) and depending on the current theme inserting the right one.
|
|
|
|
|
Have a look at this article[^]. It is vb.net code but I guess you would get something out of it
|
|
|
|