|
Dear Sir,
I am thinking about how to use IPicture class using C#.
I am developing the tool using one component.
This component have a function to draw picture.
But this interface have IPicture.
I try to look for how to get IPicture.
If you know it, please tell me.
regards,
yu-yu
|
|
|
|
|
I am trying to create a table from inside the code of a windows application written in c#.
The table will be created in a .mdb file for example.
I found out a way using ADOX but the example was poorly written and i didn't understood much(and it s not working either.. ...)
So can anyone help me?
I thank u in advance.
|
|
|
|
|
If you've already got the database, you should be able to create a table using ADO and shouldn't need ADOX.
You can create a table by issuing a "create table ..." command to the database.
Store your favourite bookmarks online: my-faves.co.uk
|
|
|
|
|
Hi dear,
How can I retrieve a website name by its IP address
|
|
|
|
|
Connect to the Server (use the IP) on port 80.
Use HTTP_GET-Command to retrieve the website in /index.htm, /index.html, etc.
Then parse the html-code you receive between and for a line starting with <title> and ending with
That would then be the "Website Name".
Cheers
Sid
|
|
|
|
|
If you want its DNS name for the IP address, have a look at the
System.Net.Dns.GetHostByAddress() method
Store your favourite bookmarks online: my-faves.co.uk
|
|
|
|
|
Hi again,
I think my last post might have been a little too confused, so I thought I might just resubmit it.
I have generated a cube consisting of 20x20x20 smaller cubes. Each smaller cube may be filled or not, so there are "holes" in my big cube.
Now, starting on one side of the cube, I want to find a way through the big cube to the opposite side.
I wont bother you with cube generation details, lets just say I am using a 20x20x20 Array to simulate the cube.
I did smell recursion here, but I am a little confused on how to get started with this.
I thought I could maybe use the following "algorithm":
bool AmIPartOfTheWay(oldcoords, newcoords)
{
If (z == 19 && iAmAHole)
return true;
else if ((AmIPartOfTheWay(cubeaboveme) || AmIPartOfTheWay (cubeleftofme) ||
....... (for each cube, just not the one I came from) )
return true;
else return false;
But that always returns there is a way through the cube.
I have the feeling that I forgot something VERY simple, but I can't think clearly when everyone around is having a party
Cheers
Sid
|
|
|
|
|
sebs2004 wrote:
If (z == 19 && iAmAHole)
what's z ? do you want to go through the cube in just 20 steps?
How do you know you're not just looping through it without getting to the other side?
I think first of all you need some criteria characterizing your end cube.
there are no facts, only interpretations
|
|
|
|
|
Oh, sorry.
x,y,z are coordinates within my cube.
z is depth, so I am pretty much only testing for top-to-bottom connections.
I need to either rotate the cube or change the end conditions later in order to be able to test for connections from the 2 other angles.
so, z==19 (Array is 0..19) && isHole indicate that I have reached a "hole" on the opposite side, ending my search.
Cheers
Sid
|
|
|
|
|
ok, so this part I don't understand:
else if ((AmIPartOfTheWay(cubeaboveme) || AmIPartOfTheWay (cubeleftofme) ||
....... (for each cube, just not the one I came from) )
return true;
it seems that the cubes repeat calling each other endlessly.
say u have a big cube of 2X2X2, and all top 4 cubes are holes, the other 4 not. than the code above returns true cause each one of the top ones has a neighbor hole, right?;)
there are no facts, only interpretations
|
|
|
|
|
I have an mdi container form that contains a tab control down the left and when a tab is clicked it loads a form to fill the reaming area inside the mdi form. The problem I have is that when it loads you can see the form beign drawn and it looks aweful. Is there anyway that the form can be loaded without it showing each control being drawn?
|
|
|
|
|
Indeed you can
at the start of your code add
this.SuspendLayout()
..and after everything's done..
this.ResumeLayout(true)
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
I have the following method to retrieve user details from Active Directory.
public StringCollection getUserDetails(string user)
{
StringCollection coll = new StringCollection();
try
{
DirectorySearcher search = new DirectorySearcher(obEntry);
search.Filter = "(SAMAccountName=" + user + ")";
search.PropertiesToLoad.Add("Name");
search.PropertiesToLoad.Add("displayName");
SearchResult result = search.FindOne();
if( result != null )
{
DirectoryEntry dirEntry = result.GetDirectoryEntry();
foreach(string key in dirEntry.Properties.PropertyNames)
{
// Each property contains a collection of its own
// that may contain multiple values
foreach( object propVal in dirEntry.Properties[key] )
{
string[] Names = {key + "=" + propVal};
coll.AddRange(Names);
}
}
}
return coll;
}
catch( Exception ex )
{
throw new Exception("User not authenticated: " + ex.Message);
}
}
All my output is returned into a stringcollection as shown below.
<string>givenName=Reinier
<string>homeDrive=M:
<string>instanceType=4
<string>lastLogoff=System.__ComObject
<string>lastLogon=System.__ComObject
The problem i have is that some values are returned as System.__ComObject. I would like to see the value there too. Is there a way to iterate through System.__ComObject and return it's values(s) ? Somewhere i have to check propVal for it's type and read out the values if type is System.__ComObject ??
Hope someone can put me on the right track !
|
|
|
|
|
The date properties are returned via the IADsLargeInteger[^] interface, which doesn't seem to have been included in the .NET framework. You will need to manually import it to get the data:
using System;
using System.DirectoryServices;
using System.Runtime.InteropServices;
public sealed class AdsiUtils
{
private AdsiUtils() {}
[
ComImport,
Guid("9068270b-0939-11d1-8be1-00c04fd8d503"),
InterfaceType(ComInterfaceType.InterfaceIsIDispatch)
]
private interface IADsLargeInteger
{
[DispId(2)] int HighPart { get; set; }
[DispId(3)] int LowPart { get; set; }
}
public static DateTime AdsDateValue(object value)
{
try
{
IADsLargeInteger v = value as IADsLargeInteger;
if (null == v) return DateTime.MinValue;
long dV = ((long)v.HighPart << 32) + (long)v.LowPart;
return DateTime.FromFileTime(dV);
}
catch
{
return DateTime.MinValue;
}
}
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
Hi Richard, thanks for your answer although i'm not there yet. I added the code to my class and get this message while compiling:
C:\Inetpub\wwwroot\ADSI\ADSI.cs(54): The type or namespace name 'IAdsLargeInteger' could not be found (are you missing a using directive or an assembly reference?)
C:\Inetpub\wwwroot\ADSI\ADSI.cs(55): The name 'v' does not exist in the class or namespace 'ADSI.ADSI'
C:\Inetpub\wwwroot\ADSI\ADSI.cs(56): The type or namespace name 'v' could not be found (are you missing a using directive or an assembly reference?)
Any idea what i'm missing here ?
|
|
|
|
|
Sorry - there was a typo in the code!
Change the first line within the try block to:
IADsLargeInteger v = value as IADsLargeInteger;
I've modified the original post to show the correct code.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
wow, works great ! this great, thanks a lot Richard !
got one more question though I also have types like these
objectGUID = System.Byte[]
objectSid = System.Byte[]
Would you happen to know how to read data form System.Byte[] ?
|
|
|
|
|
The objectGUID is simple - just call:
Guid objectGuid = new Guid((byte[])entry.Properties["objectGUID"].Value);
The objectSid is a bit more complicated. With a little help from PInvoke.net[^], the following should work:
[DllImport("kernel32.dll", SetLastError=true)]
private static extern IntPtr LocalFree(IntPtr hMem);
[DllImport("advapi32", CharSet=CharSet.Auto, SetLastError=true)]
private static extern bool ConvertSidToStringSid(
[MarshalAs(UnmanagedType.LPArray)] byte[] pSID,
out IntPtr ptrSid);
public static string FormatSid(byte[] sid)
{
if (null == sid || 0 == sid.Length)
throw new ArgumentNullException("sid");
IntPtr ptrSid;
if (!ConvertSidToStringSid(sid, out ptrSid))
throw new System.ComponentModel.Win32Exception();
try
{
return Marshal.PtrToStringAuto(ptrSid);
}
finally
{
LocalFree(ptrSid);
}
}
...
string objectSid = FormatSid((byte[])entry.Properties["objectSid"].Value);
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
string select = "Id = " + id + " AND Address = "+address+ " AND Record ="+record;
datarow[] rowa = db.var.Select(select);
id, address are variable int's and record variable string.
the problem here is that the integers are accepted but the string is not. it throws an exception: "Cannot find collumn[schools]". schools is the value of the string. the collumn name must be Record and string record is a value of a row that belongs to that collumn.
if i make a int of record, then i will accepted. But it doesn't accept a string... why?????????????
|
|
|
|
|
Your SQL WHERE command is translated to this: Lets say Id=2, address=1, record="hello":
Id=2 AND Adress=1 AND Record=hello
This is actually saying that Column [Record] should de equal to Column [hello]. That's why ur getting that error. The correct WHERE command should state that hello is a string:
Id=2 AND Adress=1 AND Record='hello'
Thus ur filter command must be:
string select = "Id = " + id + " AND Address = "+address+ " AND Record ='" + record + "'";
|
|
|
|
|
ooooww thankss. yes it worksss finee noww..
|
|
|
|
|
In my C# code i have a variable EmbedTextBox.Text = this.OpenFileDialog;
I want to use that same variable's contents in my HTML code e.g.
"<html><value=mms://server/EmbedTextBox.Text></html>"
which does not work.
is there an easy of doing this?
|
|
|
|
|
You need to programatically change the content of "value" during the creation of the HTML-Code.
Remember, even if you have a PHP, ASP or whatever script, it still needs to feed the browser valid HTML-code. So, what the server reads:
<?PHP
echo "<html><head>"
echo "<title>" + $ver + "th version of my site</title></head><body></body></html>"
?>
and sends
"<html></head><title>7th version of my site</title></head><body></body></html>"
Basically, in your code, the browser probably understands that it should fill the textbox with "mms://......." as a string, not with the content behind that link. This you would have to do via client- or server-side scripts, preferrably server-side ones.
Cheers
Sid
|
|
|
|
|
Hi all,
I have a question on c# dll loading in .Net.
Let say two dlls, dll A and dll B, object 1 in dll A
refers to an object 2 in dll B. So, if the object1
is running and invoke object 2 in dll B, will the whole dll B being loaded in the memory or just the
object 2 being loaded ? I ask this question coz I concern on the amount of memory usage.
Thanks
|
|
|
|
|
Hai pyhtang,
At runime, while obj in dll A , refers to obj in dll B,,,, only that particluar object will get loaded in to memory.
A dll is nothing but a class library, hence a dll can contain multiple classes. instatntiating a single class will load only that particlar object into memory.
Regs,
Manivannan.P
|
|
|
|