|
I m having a problem, where i need to display shared folders of a computer in C#. Like i enter a computer name and it has to display shared folders in windows explorer. i don't know how to do it? can anybody guide?
Amar
|
|
|
|
|
You'll need to utilize the Windows Shell APIs. This site has several articles on how this is done, search for 'shell' C# articles and you should get a few hits.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Conversation With a Muslim
Judah Himango
|
|
|
|
|
I wonder if u can help me in solving the following problem:
I want to divide a number by 10 and get the result as the highest number.
Let me explain with following examples:
13/10 = 2 and
27/10 = 3
How can I achieve this
thanks
|
|
|
|
|
Math.Round( (a / 10) + .5 ) ?
David
|
|
|
|
|
How about (int)((n+9)/10) ?
You can even skip the (int) if your n already is an int...
mav
|
|
|
|
|
Not knowing C# I can't give you the proper code, but in pseudo-code:
If (x - int(x)) > 0.00
return int(x) + 1
else
return int(x)
Unlike the rounding function, which will round down as well as up, this will return either the original input, if it is an integer, or the next higher integer if it contains any fractional part at all. You may still get some goofy errors, though, because the input might have some small fractional part due to previous calculations. There are ways to get around that, but they may not be necessary depending upon your application.
"...putting all your eggs in one basket along with your bowling ball and gym clothes only gets you scrambled eggs and an extra laundry day... " - Jeffry J. Brickley
|
|
|
|
|
|
gee *cough* I'll join, assuming x is an int..
int n = (x / 10) + (x % 10 > 0 ? 1 : 0);
*lame around* \o/
|
|
|
|
|
While walking at the abyss of insanity, I found out, you can use something completely senseless, far away from anything that could be called useful. Evalute strings.
int x = 27;<br />
int n = 0;<br />
string seperator = System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator;<br />
<br />
double d = ((double)x / 10.0d);<br />
string s = d.ToString("F1");<br />
<br />
if (!s.Substring(s.IndexOf(seperator) + 1, 1).Equals("0"))<br />
{<br />
d += 1.0d;<br />
s = d.ToString("F1");<br />
}<br />
<br />
n = int.Parse(s.Substring(0, s.IndexOf(seperator)));
|
|
|
|
|
Daniel, you frighten me!
mav
|
|
|
|
|
You are outta control!
|
|
|
|
|
Umm.. yes, I got it out of the abyss of insanity, I'm walking quite close to it but usually don't use anything from there
Even if it works, it's awful, but it works
I also like the ASM version from Niklas Ulvinge
|
|
|
|
|
Wouldn't this be machinecode optimised:
n >> 1;
n /= 5;
n++;
In asm it would be like:
;number in AL
SHL AL,1 ;2 clocks
MOV BL, 5 ;4 clocks
DIV BL ;0-90 clocks
INC AX ;2 clocks (saved one clock by using AX insted of AL...)
;
;I'm not familiar with how much the div instruction takes in time but
;since it is only 5 I think's it's not much.
;
The PROgrammer Niklas Ulvinge aka IDK
|
|
|
|
|
Thanks for many ideas. This is what worked for me:
Math.Ceiling(13.0D / 10.0D);
Only if the values inside Ceiling(...) are Double and not int
|
|
|
|
|
Hi,
I'm reading in a DBase V database with an ODBC dataAdapter. This went well with the first version of the database, but I got an update friday and this one crashes. The strange thing is, it goes to the catch block on the fill method and crashed on the Exception itself.
so :
try{<br />
adapter.Fill(dataset);<br />
}<br />
catch(Exception e1){<br />
}
the error is a nullreference exception of e1??
Could it be the database is corrupt because it was zipped? I put the previous version back, but it still crashes and I didn't change any code in the meantime.
the execute statement is just a Select * from table .
I hope somebody can help me,
tnx!
No hurries, no worries.
|
|
|
|
|
i want to write a program that count data loading from internet, how can i do it?
|
|
|
|
|
What do you mean by "count data"? This is no where near enough information to answer your question.
|
|
|
|
|
I mean, i want to know how much data (in bits or bytes) that my computer has been loading from the internet each time i'm online.This program helps me to calculate how much money i have to pay for using Internet each month.Experts help me please !! i'm so poor
|
|
|
|
|
How to set list view item (detailed view) as selected and focused?
thanks
|
|
|
|
|
ListViewItem it = listView1.Items[3]; // pick an existing item to select
it.Selected = true; // select item
listView1.Focus(); // focus the listview
mav
|
|
|
|
|
Hello!
I am trying to query an open relay database (ordb.org) using a DNSquery. I have constructed a DNSquery and it works against any regular DNSserver but when I use the query against ordb.orgs database I never recieve any answer. So does the regular DNSqueries differ from the ones i should send to the open relay database? From what I have learned it shouldn't.
The FAQ for using DNSqueries at ordb.org is located here http://www.ordb.org/faq/#usage_dns[^]
Any help is more than welcome!
Best regards
Kristofer
|
|
|
|
|
Dear All
I have a class that implements IMessageFilter:PreFilterMessage(ref Message m)
If M.Msg = WM_KEYDOWN I want help to get data from m.LParam
the desprate developer
|
|
|
|
|
Ok, so you know the keydata is in LParam. What's the problem? Are you asking how to get the various values out of the 32-bit Integer that is LParam?
WM_KEYDOWN Notification[^] docs on MSDN.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i have two forms in a project...1 has the treeview control, so whn i right click on a node and say add, other form is displayed in which i will enter the details.
now when i click on save button,the name tat i typed in textbox has to get inserted as a child to the selected node...how do i do that?
i tried in treeview1.mousedown_click even,in right button clikc...
geotree .SelectedNode = geotree .GetNodeAt(e.X,e.Y);
TreeNode tnode=new TreeNode();
tnode=geotree.SelectedNode;
tnode.Nodes.Add(
here how i'll get the textbox value from the other form in which i've entered the details??????
|
|
|
|
|
Just add a property to the other form that'll get you the text entered. Something like
public class OtherForm : Form
{
private TextBox someTextBox;
public string FormText
{
get { return someTextBox.Text; }
}
}
You can then do
OtherForm otherForm = new OtherForm();
otherForm.ShowDialog();
...
tnode.Nodes.Add(otherForm.FormText);
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|