|
This is vb code transfer in C#
Protected Sub dgAdminList_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles dgAdminList.RowUpdating
Dim intActiveStatus as integer
Dim ChkActiveTemp As CheckBox
ChkActiveTemp = dgAdminList.Rows(e.RowIndex).FindControl("chkActive")
If ChkActiveTemp.Checked Then
intActiveStatus = 1
Else
intAdminStatus = 0
End If
end sub
|
|
|
|
|
Thank you very much for the code. I used updating event of the sql datasource for setting the parameters again.(checkbox field parameter only )..and it worked..
Thanks again for the reply..
Ranjith Stephen
|
|
|
|
|
My code is
protected void SQL_DS_Updating(object sender, SqlDataSourceCommandEventArgs e)
{
if (e.Command.Parameters["@IMPA"].Value.ToString() == "True")
e.Command.Parameters["@IMPA"].Value = true;
else
e.Command.Parameters["@IMPA"].Value = false;
}
I've changed my database field to 'BIT'
Ranjith Stephen
|
|
|
|
|
For the application I am working on I need something with more power then a standard tree view, but with allot of the same functionality.
I want to be able to multi-link nodes basically. So that a node is not a node of just a single parent, necessarily, but can be a child node of multiple parents, or other nodes.
I would also like to represent this more graphically, using boxes to represent each node or parent and then using lines to show how they all connect.
I can write this myself but I thought I would check and see if anyone knew of a Windows Forms control like this/that supports this. Or maybe not necessarily something that is exactly like this but that would at least save me allot of time because I could just modify it instead of starting from scratch.
Thanks in advance for any replies.
--Peter
|
|
|
|
|
Hi,
I'm a newbie, going through .NET data types, and I couldn't quite understand the declaration of decimal types, say
decimal 12.30M OR decimal 12.30m
Also, how do you assign precision? How important is it to keep in mind implicit and explicit conversions (any rule of thumb?) Are they generally suggested in view of performance impact they may have?
Jon
|
|
|
|
|
decimal d = 5M; and decimal d = 5m; are both perfectly fine.
I think you can't assign precision (I believe it's 10 decimal places, though I'm not sure). decimal is implemented in software, so obviously there _will_ be a performance hit, though I don't know by how much.
jon_80 wrote: How important is it to keep in mind implicit and explicit conversions
From what? I suggest you never store anything representing money in floats/doubles, unless precision doesn't matter much.
Cheers,
Vıkram.
Déjà moo - The feeling that you've seen this bull before.
Join the CP group at NationStates. Password: byalmightybob
|
|
|
|
|
Hi,
i want an string-array with a fixed size within a struct. How can I achieve this?
The normal way to initialize the array doesn't work.
Also using fixed is no solution because it does not support the type string (a string has no fixed size).
public struct Order
{
public string owner;
public string prognr;
public string number = new string[20];
}
Thanks in advance
|
|
|
|
|
you can use class in the same way
public class Order<br />
{ <br />
public string owner; <br />
public string prognr; <br />
public string []number = new string[20];<br />
}
|
|
|
|
|
JF2015 wrote: public string number = new string[20];
That should be
public string[] number = new string[20];
Cheers,
Vıkram.
Déjà moo - The feeling that you've seen this bull before.
Join the CP group at NationStates. Password: byalmightybob
|
|
|
|
|
Hi Vikram,
if I try this I get an error saying:
Compiler Error CS0573
Error Message
'field declaration' : cannot have instance field initializers in structs
So, obviously I can't initialize this array within the struct, but initializing the array out of the struct as:
Order or = new Order();
or.Number = new or.Number[20];
is also not working.
|
|
|
|
|
Create a default constructor that initialises the field.
JF2015 wrote: or.Number = new or.Number[20];
That's never going to work, what do you expect it to do ? or.Number = new string[20]; assuming it's an array of strings, is what you need.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Ok,
my fault, i originally thought that i had to initialize the array within the struct, but didn't know i had to do it like you wrote.
Thanks alot
|
|
|
|
|
Glad to help
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I'm sorry, I wasn't paying attention to the fact that you wanted it inside a type.
Cheers,
Vıkram.
Déjà moo - The feeling that you've seen this bull before.
Join the CP group at NationStates. Password: byalmightybob
|
|
|
|
|
Hello!
I have a string which has numbers(digits) at the beginning(don't know how many) and letters at the end(again, don't know how many).
What regex pattern should I use to get just the first part(the numeric one)?
ex:
34546AX -> 34546
12ELFY -> 12
Thanks.
|
|
|
|
|
[0-9]{1,}
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.
|
|
|
|
|
Thank you.
Learning Regular Expressions has been on my TODO list for some time, but somehow, something else always got in front of it in the waiting queue.
By the way, could you recommend a good resource for learning regex?
Thanks again.
|
|
|
|
|
blackjack2150 wrote: Thank you.
You're welcome.
blackjack2150 wrote: By the way, could you recommend a good resource for learning regex?
Oh, I'm not an expert about. I usually read MSDN (that usually is great), but IMHO Regex topic is not that good...
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.
|
|
|
|
|
for biginning of word use <[0-9]+
for biginning of line use ^[0-9]+
|
|
|
|
|
Hi,
I am using TCPClient for requesting web pages.
ex:
string Ahost = "http://www.Google.co.in";
Uri lastURI=new Uri(Ahost);
TcpClient client = new TcpClient();
string host = lastURI.Host;
string temp = lastURI.PathAndQuery;
client.Connect(host, lastURI.Port);
NetworkStream stream = client.GetStream();
string str = @"GET " + temp + " HTTP/1.1" + "\r\n" +
@"Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*" + " \r\n" +
@"Accept-Language: en-us" + "\r\n" +
@"Accept-Encoding: gzip, deflate" + "\r\n" +
@"User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)" + "\r\n" +
@"Host: " +host+ "\r\n" +
@"Connection: Keep-Alive" + "\r\n\r\n";
byte[] send = Encoding.ASCII.GetBytes(str);
try
{
if (stream.CanWrite)
{
stream.Write(send, 0, send.Length);
}
}
catch (System.IO.IOException ioe)
{
Console.WriteLine(ioe.Message);
}
byte[] bytesToRead = new byte[client.ReceiveBufferSize];
MemoryStream ms = new MemoryStream();
StringBuilder sbuild = new StringBuilder();
do
{
try
{
int numBytesRead = stream.Read(bytesToRead, 0, client.ReceiveBufferSize);
Console.WriteLine(numBytesRead.ToString());
ms.Write(bytesToRead, 0, numBytesRead);
Console.WriteLine(ms.Length);
}
catch (Exception e)
{
Console.WriteLine("No Data Found");
}
}while(stream.DataAvailable);
ms.Seek(0, 0);
StreamReader sr = new StreamReader(ms,Encoding.ASCII);
string Result = sr.ReadToEnd();
sr.Close();
ms.Close();
stream.Close();
client.Close();
Console.WriteLine(Result);
}
}
In the above case How can i use the same TCPClient object for more than one
request provided the host is same.(in case of requests like
http://www.google.co.in/
http://www.google.co.in/intl/en_com/images/logo_plain.png
http://www.google.co.in/images/nav_logo3.png )
Please Help
Sakthi.
|
|
|
|
|
string[] str1 = new string[3] { "http://www.google.co.in/", "http://www.google.co.in/intl/en_com/images/logo_plain.png", "http://www.google.co.in/images/nav_logo3.png" };
string Ahost = "http://www.Google.co.in";
Uri lastURI=new Uri(Ahost);
TcpClient client = new TcpClient();
string host = lastURI.Host;
client.Connect(host, lastURI.Port);
NetworkStream stream = client.GetStream();
for (int i = 0; i < str1.Length; i++)
{
string temp = new Uri(str1[i]).PathAndQuery;
string str = @"GET " + temp + " HTTP/1.1" + "\r\n" +
@"Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*" + " \r\n" +
@"Accept-Language: en-us" + "\r\n" +
@"Accept-Encoding: gzip, deflate" + "\r\n" +
@"User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)" + "\r\n" +
@"Host: " + host + "\r\n" +
@"Connection: Keep-Alive" + "\r\n\r\n";
byte[] send = Encoding.ASCII.GetBytes(str);
try
{
if (stream.CanWrite)
{
stream.Write(send, 0, send.Length);
}
}
catch (System.IO.IOException ioe)
{
Console.WriteLine(ioe.Message);
}
byte[] bytesToRead = new byte[client.ReceiveBufferSize];
MemoryStream ms = new MemoryStream();
StringBuilder sbuild = new StringBuilder();
do
{
try
{
int numBytesRead = stream.Read(bytesToRead, 0, client.ReceiveBufferSize);
Console.WriteLine(numBytesRead.ToString());
ms.Write(bytesToRead, 0, numBytesRead);
Console.WriteLine(ms.Length);
}
catch (Exception e1)
{
Console.WriteLine("No Data Found");
}
} while (stream.DataAvailable);
ms.Seek(0, 0);
StreamReader sr = new StreamReader(ms, Encoding.ASCII);
string Result = sr.ReadToEnd();
sr.Close();
ms.Close();
//stream.Close();
stream.Flush();
Console.WriteLine(Result);
}
client.Close();
|
|
|
|
|
Hi Subrata,
Actually in my case i may not know the URLs in advance.
If the host of requested url is same as the host of Previous Url
I should be able to use the same connection.
I tried the same without closing the underlying connection.
While reading for the next request,i am getting an exception as
Connection closed. Is it possible set the connection timeout.
Sakthi.
|
|
|
|
|
But please help
<code>string fullString = @"value1;value2;value3";
string []arString =
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hi,
string[] arString=fullString.Split(';');
This will split your string.
Sakthi
|
|
|
|
|
I knew that was a terribly stupid question to ask
Thanks Sakthi
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|