|
Hi All,
I want to make scroll in the from, i set Allow scroll property to true but it doesn't work, so if there is another option please anyone help me
Thanks alot
|
|
|
|
|
Could you clarify what you are trying to accomplish? What are you scrolling?
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
i want to scroll form itself coz it hold alot of controls and its size 900*800 so if the project run on any computer with resolution less then 1024*768 controls will not be appear, so can i make scroll in the form to be used in any resolution
Thanks for youe reply
|
|
|
|
|
Hi, I'm developing a MediaCenter Type of Application. There seem to be two options for playing Audio/Video using Media Control Interface (MCI) and DirectX. As I'm new to C# can you tell me which one should I choose and their respective benefits. My primary concern is that whatever I choose should put minimum load on the system. I'm open to other suggestions as well.
Thanks...
P.S: I havent particularly liked the approach required to use MCI.
|
|
|
|
|
Erhm, i'd recommend DirectX. For now you can use it for just playing tracks, no problem, you can also use MCI instead. But if you'd like to expand the possibilities of your app, you'll be stuck to the MCI limitations.
|
|
|
|
|
Hi,
I have seen from the PetShop .NET project that they have the following method for creating salt:
private string GenerateSalt()
{
byte[] buffer = new byte[SALT_SIZE_IN_BYTES];
(new RNGCryptoServiceProvider()).GetBytes(buffer);
return Convert.ToBase64String(buffer);
}
SALT_SIZE_IN_BYTES = 16. Is this the best way to do it? Is this how the default membership provider does it?
Regards
ma se
|
|
|
|
|
That's about how I do it. Don't generate a salt size too big otherwise you'll end up with a Base64 string the length of a aircraft carrier. I find that 10 to 20 bytes is sufficient.
I just got done explaining this to someone else, here[^].
-- modified at 12:33 Friday 13th July, 2007
|
|
|
|
|
I having a weird problem with remoting and I think it is due to Symantec's firewall that we have installed on all our computers as part of IT's standard setup. In my application I have a remote object that the server publishes using RemotingConfiguration.RegisterWellKnownServiceType. The server then also gets a copy of the object itself using Activator.GetObject. This works fine if I'm connected to our corporate network. However, when I'm disconnected it doesn't work. I get a message that the "No connection could be made because the target machine actively refused it". The weird part is that once in a while, it actually does work!
I checked out our Symantec firewall (which I can't change settings on) and watched it as I tried to connect and I notice that the number of blocked inbound connections does increase when I attempt to start my server (but the number of allowed connections also increases). When I'm connected to the network, I don't get any increase in the number of blocked connections. Digging deeper, Symantec has a category called "Blocked unmanaged TCP/UDP inbounds" which increases when I try and start my server while off-line.
Does anybody know what it means by "unmanaged" in this context? It seems like the server registering the well known service type is accepted but the attempt to connect to that well know service is not. Is there a way to convince this POS firewall that it should allow my connection?
I'm totally screwed if I can't find a way around this
|
|
|
|
|
Have you figured this one out?
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
Actually, I just did. It seems that if I set rejectRemoteRequests when I create the TcpChannel on the server the firewall doesn't block it anymore. So I think the solution is to check when creating the server to see if I'm online and if not set rejectRemoteRequests and assume that the client has to be on the same computer (which it does, because we're offline anyway).
The only problem I see with this is if the computer was not connected when the server starts, but is then connected later (or vis-versa) but I don't think that's something I'm going to worry about.
It still mystifying as to why the firewall blocks activity on a port when not connected to the network, but has no problem with it when you are connected (and it could actually be a malicious attack).
|
|
|
|
|
Wjousts wrote: It still mystifying as to why the firewall blocks activity on a port when not connected to the network
That is really odd
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
I want to declare the object of a class at run time. For example if string str="schedule" then declare the object of Schedule class and pass this string to its construction.
Is there any way to do that? Please tell me the solution..
|
|
|
|
|
This can be done using reflection. Plenty of good article online, just google C# reflection
Christian Graus - Microsoft MVP - C++
"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 did google on this. The only thing I got is that you can get the type and member info of a class. I couldn't find any way to declar the object of a class at run time.
If you know the code, please write it.
|
|
|
|
|
You can use either Activator.CreateInstance() or Assembly.CreateInstance()
|
|
|
|
|
You can do this using reflection.
Here's an example using .NET 1.1.
Assembly assembly = Assembly.GetExecutingAssembly();
string continentFactory = ConfigurationSettings.AppSettings["ContinentFactory"];
Binder binder = null;
Type continentType = assembly.GetType(continentFactory);
object[] args = null;
ContinentFactory continentInstance = (ContinentFactory) continentType.InvokeMember(
null,
BindingFlags.DeclaredOnly |
BindingFlags.Public | BindingFlags.NonPublic |
BindingFlags.Instance | BindingFlags.CreateInstance, binder, null, args
);
string animalWorld = "PatternsTest.AnimalWorld";
Type worldType = assembly.GetType(animalWorld);
args = new object[] { continentInstance };
AnimalWorld worldInstance = (AnimalWorld) worldType.InvokeMember(
null,
BindingFlags.DeclaredOnly |
BindingFlags.Public | BindingFlags.NonPublic |
BindingFlags.Instance | BindingFlags.CreateInstance, binder, null, args
);
worldInstance.RunFoodChain();
);
Kevin
|
|
|
|
|
Hello all,
I have a background thread that updates some userControls. To do this updates, I call invoke on the control, from the background thread, after testing for invokeRequired. No problem so far...
The problem begun when I tried doing this updates before the userControl has been displayed (like when it is on a hidden tagpage). In this case, the control does not have a handle yet, and invokeRequired returns false, causing my logic to make the backgroud thread to update the control directly. There´s no need to say what happened to my application next...
Then, to avoid this, I have begun to test is the userControl has a Handle, and if it hasn´t, I do control.CreateControl(). After this, it seemed like I could update the control using invoke properly. But now my application is freezing sometimes, like what happens when another thread tries to update a control without calling invoke.
How can I solve this? I realy need that all controls are created when this backgroud thread begins its job...
Thanks
Peterson
|
|
|
|
|
When do you start the background thread?
You shouldn't be seeing controls without handles. The only time that occurs is in the constructor. Once the constructor returns all the controls should be completely created.
You could always go through all your controls and call CreateControl() in your constructor, just to make sure the controls are all created. That way you're not making that call from another thread.
CreateControl() is a thread-bound operation and should only ever be called on the GUI thread.
|
|
|
|
|
Peterson Luiz wrote: The problem begun when I tried doing this updates before the userControl has been displayed (like when it is on a hidden tagpage).
There is a hack to get this to work. Just make sure you refer to the control's Handle property somewhere (in the correct thread, of course). The getter for Handle creates a handle if it already hasn't been created and it all works fine thereafter. I usually put it right after InitializeComponent.
class MyForm : Form
{
MyControl control;
public MyForm()
{
InitializeComponent();
IntPtr val = control.Handle;
Console.WriteLine(val.ToString());
}
}
Note that it's a hack and it relies on an implementation detail which might change in the future.
|
|
|
|
|
>I have a List<string> of IP Addresses in _check.GroupData. I iterate through the list, pinging, asynchronously, each machine. I've stripped out the vast majority of the code, which is why the stuff below looks functionally useless, but it shows the code I am running which leaks like a seive.
Monitoring with PerfMon you can see the private bytes for the process go sky high, and never come back.
Any ideas?
#using System.Net.NetworkInformation;
override public void Check()
{
foreach (string ipAddress in _check.GroupData)
{
Ping tmpPing = new Ping();
try
{
System.Threading.Interlocked.Increment(ref _pingsOutstanding);
tmpPing.PingCompleted += new PingCompletedEventHandler(ping_PingCompleted);
tmpPing.SendAsync(ipAddress , 10000 , ipAddress);
}
catch (Exception e)
{
}
}
while (_pingsOutstanding > 0)
{
System.Threading.Thread.Sleep(1000);
}
}
void ping_PingCompleted(object sender, PingCompletedEventArgs e)
{
System.Threading.Interlocked.Decrement(ref _pingsOutstanding);
(sender as Ping).Dispose();
return;
}
sorry about the layout - pushed for time fixing other stuff!
Cheers
Malc
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
|
|
|
|
|
It is possible that garbage collection just hasn't decided to reclaim the memory. Just for fun you could try GC.Collect at the end of your processing to force garbage collection. That might free up all the memory. If it does then you probably don't have a memory link.
My only other thought is the way you are using the Ping variable inside the loop. If you had a variable out side of your method, perhaps a generic list. Add each of the ping objects to it. Then when all your threads are done loop through your generic list and free the ping objects.
Hope that helps.
Ben
|
|
|
|
|
You won't believe me, but the container of 'pings' was going to be my next step. I'll try the GC.Collect though - stupidly, I didn't realise you could call the GC explicitly. Thanks for that.
kubben wrote: Just for fun you
- is it not good practice then to call GC.Collect?
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
|
|
|
|
|
Malcolm Smart wrote: - is it not good practice then to call GC.Collect?
It's generally not, but for testing purposes doing it will let you see if the GC simply hasn't gotten around to releasing the memory, or if there's an actual leak.
--
You have to explain to them [VB coders] what you mean by "typed". their first response is likely to be something like, "Of course my code is typed. Do you think i magically project it onto the screen with the power of my mind?" --- John Simmons / outlaw programmer
|
|
|
|
|
Well, Microsoft says that Garbage collection does take up resources time etc. So in general the discourage its use mainly for performance reasons. If they really didn't want us to use it they wouldn't have exposed it.
My experience with it is, it can seem that you might have a memory link, but for some reason garbage collection has just not decided to run. Anyway, if you run it manually you will know if you have a memory link or not.
Ben
|
|
|
|
|
Garbage collecting made no difference. I'm going to try and run the pings synchronously now - will take an age as we have so many machines in the farm, but it will eliminate the asynch aspect of the call.
Watch this space....
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
|
|
|
|