|
How can i do check box tick box in .net? I think it is imposibble via using properties.
Thanks for your interesting
|
|
|
|
|
What do you want ? For a check box to show a tick ? You'll need to draw that yourself
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hello;
I mean; is it possible to enlarge check box's tick box,
Thanks
Best Regards
|
|
|
|
|
How is this possible?
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
{
switch (e.CommandName)
{
case "1":
HiddenField n = (HiddenField)e.Item.FindControl("IDProizvoda");
break;
case "2":
n = (HiddenField)e.Item.FindControl("IDProizvoda");
break;
}
}
In Case"2" how can compiler know that n is HiddenField?
|
|
|
|
|
HiddenField n has been declared before in the same {} block, the one that contains
all the switch cases. This may be counter-intuitive, but it is how C# looks at it.
Luc Pattyn
|
|
|
|
|
Thanks!
|
|
|
|
|
hi,
adding to what Luc Pattyn explained, here is a remark from specification
"The statement-lists of a switch-block may contain declaration statements (§15.5). The scope of a local variable or constant declared in a switch block is the switch block."
please note that a statement-list has obviosly to be in a sequence and reachable.
|
|
|
|
|
This question has already been answered, but I just wanted to add that you can use more curly braces to further delimit the scope of variables. For example:
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
{
switch (e.CommandName)
{
case "1":
{
HiddenField n = (HiddenField)e.Item.FindControl("IDProizvoda");
...
break;
}
case "2":
{
Hiddenfield n = (HiddenField)e.Item.FindControl("IDProizvoda");
...
break;
}
}
}
In your example it probably doesn't matter, but this certainly comes in handy when case blocks become larger and you want to keep your code partitioned.
|
|
|
|
|
Useful tip Thanks!
|
|
|
|
|
I don't know how to create a file.
txt or inf.
Vasildb
|
|
|
|
|
There are many ways, e.g.
void example() {
string[] strings=Environment.GetCommandLineArgs();
writeStringArray(strings, @"C:\myFolder\myNewFile.txt");
}
void writeStringArray(string[] strings, string fileSpec) {
Directory.CreateDirectory(Path.GetDirectoryName(fileSpec));
using (StreamWriter sw=new StreamWriter)fileSpec)) {
foreach(string s in strings) sw.WriteLine(s);
}
}
Luc Pattyn
|
|
|
|
|
Hallo there! I am trying to set up a simple client - server application for educational reasons and I have a problem resolving the real IP address of my server app. I use the code presented below :
IPHostEntry IPHost = Dns.GetHostEntry(Dns.GetHostName());
label1.Text = "Server IP: " + IPHost.AddressList[0].ToString();
and i keep taking in the label "Server IP: 192.168.2.2" that works locally but if i try it through an external PC in another subnet it doesn't seem to work. And the question is how can i take my real address (which i guess it's the router's address) that is 85.75.1.3?
Thank u in advance!
There is no patch for human stupidity
|
|
|
|
|
patonios wrote: but if i try it through an external PC in another subnet it doesn't seem to work
What kind of error or data are you getting?
patonios wrote: how can i take my real address (which i guess it's the router's address) that is 85.75.1.3
You could use the gateway details if your router is configured as one.
You can also try to use the Tracert(try run->cmd->tracert www.codeproject.com) and adding some logic could fetch you the router address. You may have to find out the last ip address which falls within the private address cat and the next entry to it would be your router address.
Tarakeshwar Reddy
MCP, CCIE Q(R&S)
|
|
|
|
|
Thanks for your response. First of all i want to clarify that when i say it doesnt seem to work i mean that the label's text show my local address 192.168.2.2 and not my real address 85.75.1.3 so i guess if i finish my app it wouldnt be possible to find my server if i put 192.168.2.2 as the server's address.
I can retrieve my real IP address by using me routers settings or using a traceroute app or simply by visiting whatismyip.com but i want to have it dynamically through my C# code. And i was wondering if there is a way using the dns class or another existing class.
i am waiting for more ideas.
Thanks again for your time.
There is no patch for human stupidty
|
|
|
|
|
I have folderBrowserDialog1 and openFileDialog1 .
How to check that the file selected with openFileDialog1 is in the folder selected with folderBrowserDialog1 .
Vasildb
|
|
|
|
|
if (folderBrowserDialog1.SelectedPath == Path.GetDirectoryName(openFileDialog1.FileName)) {}
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
if(Path.GetDirectoryName(openFileDialog1.FileName) == folderBrowserDialog1.SelectedPath)
{
}
PS.
I haven't tested it. Maybe it would need some adjustment.
Regards
|
|
|
|
|
hi everyone,
anyone knows how to play two sounds together without interrupting the previous sound?? any good articles??
many thanx
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hi Muammar,
I dont think you can easily get multiple sounds.
I have seen many games with a single sound; when two sounds are required, the
second one is not launched, or the first one gets aborted.
Now as long as only one sheep is visible this should not be a problem
Luc Pattyn
|
|
|
|
|
|
System.Media.SoundPlayer should work, no?
|
|
|
|
|
Of course.
I'm still trying to write code that also runs on .NET 1.1 and have not used
System.Media namespace yet.
Luc Pattyn
|
|
|
|
|
oh please dont be sad Luc, cuz i tried it and it's not working either
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
Nope!!
thanx for your help
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hello !
I'm trying to get URL from IE which is currently opened. Is there any way to get it? Is it possible with C# ?
Regards,
|
|
|
|