|
Hard to tell without seeing the code. Could you post relevant code here?
|
|
|
|
|
in form1 this code
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Form2 gv = new Form2();
dd();
this.Hide();
}
private void dd()
{
Form2 ss = new Form2();
ss.Show();
}
sorry i can not write the design of form 1 part but it an user control that represent a .avi video
thanks very much
Mohamed
|
|
|
|
|
I believe Form1 is your start-up form. When Application.Run(new Form1()) is executed, it sets the Form1 's visibility to true. This happens after your call to this.Hide() in Form1 's constructor. This is the reason why first form is still visible.
Are you looking to implement a splash-screen? If yes, this is not the correct method. Try the following points
- Show the Form1 before the call to
Application.Run - Keep a timer on Form1 with interval as 3secs and when timer ticks, unload the form.
- Instantiate Form2 and start message loop on that.
Application.Run(new Form2()) .
modified on Thursday, September 24, 2009 4:47 AM
|
|
|
|
|
Hello All ,
I have windows media player contrl. Now i will have 4 buttons when i click one butoon it should play the video , second one should pause , third one should do step forward and fourth one should step backward .
can u please me tell me how to achieve these functionalities.
regards,
phani
|
|
|
|
|
var c = yourMediaPlayer.Ctlcontrols;
c.play();
c.stop();
c.pause();
|
|
|
|
|
HelloNaveenth ,
Thanks for the help.
Can u tell me how to implement Pause and play form the same location
If i pause and then i click play it should play form there only .
I tried with that play method but it is playing from the Start.
Regards,
Phani
|
|
|
|
|
I am not sure. Here is what MSDN[^] says
The play method begins playback of the current media item, or resumes playback of a paused item.
|
|
|
|
|
MemoryStream stream = new MemoryStream(); VisitorPhoto1.Image.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);
byte[] pic = stream.ToArray();
error on second line......... pls help me thanks in advance
|
|
|
|
|
Which statement is the "second line"?
What are you trying to accomplish? Getting an image into a byte array? That shouldn't require a stream.
|
|
|
|
|
VisitorPhoto1.Image.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg); // second line
i want to store the image present in the picture box to sql database
|
|
|
|
|
amaankhan wrote: error on second line.
On VisitorPhoto1.Image.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg); ? if yes, either VisitorPhoto1 is NULL or VisitorPhoto1.Image is NULL .
|
|
|
|
|
hi all
i have a query written in MS access which check if variables exist in the table then dont inser but if not the variables are inserted twice this is my problem.below is the code
INSERT INTO IPAdress ( IP, Machine_Name)
SELECT '3', 'sss' from IPAdress WHERE NOT EXISTS
(SELECT null FROM IPAdress WHERE IP = '3' AND Machine_Name = 'sss' )
in oracle there is a dual table so the query can be modified a bit and it works fine.the query which works in oracle is
INSERT INTO IPAdress ( IP, Machine_Name)
SELECT '3', 'sss' from dual WHERE NOT EXISTS
(SELECT null FROM IPAdress WHERE IP = '3' AND Machine_Name = 'sss' )
|
|
|
|
|
Just leave out the first "from IPAdress".
Create your own dual table. ::shrug::
modified on Thursday, September 24, 2009 2:48 AM
|
|
|
|
|
|
Yeah, that works for SQL Server, but I didn't test it with Access.
|
|
|
|
|
Hi,
Consider the following:
public interface interface1
{
//some methods
}
public class A:interface1
{
//do something with methods in interface1
}
Now in the main class to create an object, can the following code be used:
interface1 I1 = new A();
is this a correct way? shouldn't it be
A a = new A();
If both the methods are correct what is the difference between the two?
Thanks.
|
|
|
|
|
Yes, but when accessing I1, you can only access the members defined by interface1, not other members defined in A.
So, you don't often do that, but there are times you may want to.
|
|
|
|
|
yes..the scenario is we want to access only the methods defined in the interface.So which method is better?
|
|
|
|
|
I wouldn't say either is better. In your example you seem to declare a local variable, which is unlikely to be a situation where using the interface is beneficial/required, so I would use the class.
Using an interface may be of benefit when declaring a field, a parameter, or a return type.
|
|
|
|
|
can you explain me how "Using an interface may be of benefit when declaring a field, a parameter, or a return type."...
Maybe with an example program would help me understand better.
|
|
|
|
|
Consider the following example for using interface as parameter
class Driver
{
IVehicle vehicleToDrive = null;
Driver(IVehicle vehicleToDrive){
this.vehicleToDrive = vehicleToDrive;
}
public void StartDriving() {
vehicleToDrive.Start();
vehicleToDrive.ChangeGear();
vehicleToDrive.Accelerate();
}
} In the above example, you are programming against an interface. The driver is generic and can drive any vehicle that implements IVehicle . In such situations interfaces are useful.
Following example shows how it is helpful in return types.
IVehicle vehicle = VehicleRepository.Create("Benz");
class VehicleRepository
{
public static IVehicle Create(string vehicleName)
{
IVehicle vehicle = null;
if(vehicleName == "Benz")
vehicle = new Benz();
else if(vehicleName == "Ford")
vehicle = new Ford();
return vehicle;
}
} VehicleRepository.Create method can implement any concrete type of vehicles without changing the return type.
Here is an example when it is used as field.
class BusinessValidation
{
IValidator[] validators = {
new NameValidator(),
new AgeValidator(),
new DesignationValidator() };
void Validate()
{
foreach(IValidator validator in validators){
validator.PerformValidation();
}
}
} Hope it is clear now.
|
|
|
|
|
thanks for the explanation. Now i understand it better.
|
|
|
|
|
shivapriyak wrote: So which method is better?
It depends. If you know the concrete type at the time of writing, use
A a = new A(); If you are using some factory method to create the instance, use
interface1 a = Create() This will help to change the underlying implementation without breaking the contract.
|
|
|
|
|
I have a scenario where we develop a class library which we give to the clients to use in their applications.
Inside the library we have implementations like:
IList<string> ModulesPath = new List<string>(16);
This 'ModulesPath' is used inside the class library (not exposed to the user). So is it correct to have 'ModulesPath' of type IList or List?
However we have another vaiable as:
IIAD i = InstrumentDomain.iad;
here 'IIAD' is a interface(which is in a separate class library) and 'InstrumentDomain' is the class which implements it(this is in a different class library.)
We give both the dlls to the client so that he can write a code as above.
So here, should 'i' be of type IIAD or of type InstrumentDomain i.e. the concrete class?
|
|
|
|
|
shivapriyak wrote: So is it correct to have 'ModulesPath' of type IList or List?
I'd use List ModulesPath = new List(16); here. Because, I know the concrete type is going to be List .
shivapriyak wrote: So here, should 'i' be of type IIAD or of type InstrumentDomain i.e. the concrete class?
This is a good place where writing IIAD i = InstrumentDomain.iad; makes more sense. It also allows you to add a different concrete type in future without making any changes in the contract.
|
|
|
|