|
One simple questions abuot matrixes:
<br />
<br />
public class MyClass<br />
{<br />
private int[] List;<br />
...<br />
void SetDimension(int L){<br />
List=new int [L];<br />
}<br />
int GetListLength(){<br />
return List.Length;<br />
}<br />
}<br />
The function GetListLength failed (Iusing .Length) if it is never called SetDimension before, but I like that that function returns 0.
So, How to know that List is declared but not defined?
That is, Is there any propertyes like List.IsUndefinied() that I can use?
Cheers,
Russell
|
|
|
|
|
In the constructor for MyClass set List to null . Then GetListLength can check it to make sure List is non-null before it tries to access its members.
|
|
|
|
|
Thank you
Cheers,
Russell
|
|
|
|
|
hello everyone,
I am trying out a few things with MediaPlayer. I am currently creating the Windows Media Player Control Programmatically(i.e without adding a MediaPlayer control into the Application, I need to run it)
After downloading the MediaPlayer SDK and adding wmp.dll reference,
I am using the below code to do this.
WMPLib.WindowsMediaPlayer Player;
private void PlayFile(String url)
{
Player = new WMPLib.WindowsMediaPlayer();
Player.PlayStateChange +=
new WMPLib._WMPOCXEvents_PlayStateChangeEventHandler(Player_PlayStateChange);
Player.MediaError +=
new WMPLib._WMPOCXEvents_MediaErrorEventHandler(Player_MediaError);
Player.URL = url;
Player.controls.play();
}
private void Form1_Load(object sender, System.EventArgs e)
{
// TODO Insert a valid path in the line below.
PlayFile(@"c:\myaudio.wma");
}
private void Player_PlayStateChange(int NewState)
{
if ((WMPLib.WMPPlayState)NewState == WMPLib.WMPPlayState.wmppsStopped)
{
this.Close();
}
}
private void Player_MediaError(object pMediaObject)
{
MessageBox.Show("Cannot play media file.");
this.Close();
}
Problem:
I got the above code from MSDN and it is playing the video file at the background but I am not able to see the MediaPlayer on the monitor. I can just hear the audio of the file. Can someone tell me what the problem is.
There is nothing wrong with the windows media player as far as I know
Thanks and Regards
kraj
|
|
|
|
|
hello!
try this
Player = new WMPLib.WindowsMediaPlayer();
Player.PlayStateChange +=
new WMPLib._WMPOCXEvents_PlayStateChangeEventHandler(Player_PlayStateChange);
Player.MediaError +=
new WMPLib._WMPOCXEvents_MediaErrorEventHandler(Player_MediaError);
//Player.URL = url;
Player.openPlayer(url);
//Player.controls.play();
hope that's what you want! !
Adeel
--
|
|
|
|
|
Hey. Thanks for the reply. But there is a problem with OpenPlayer. I have tried that method before. Player.OpenPlayer(url) opens the MediaPlayer and plays the video file but we lose control over that player(i.e U cannot Stop or Pause the MediaPlayer Programmatically). Player.Stop(), Player.Pause() doesn't work.
Kraj
|
|
|
|
|
Hello, someone can indicate to me like putting a link on “today” on pocket pc 2003 / Wm5 (exactly like the tom tom)?
Thanks.
Alex
|
|
|
|
|
I have a datagrid view with some field in there.
The header in in the head of the view but I need it in the first the rows.
Can u tell me?
Thanks!
Hello World !
|
|
|
|
|
|
Hey,
In our application, I want to generate 8 characters hexadecimal unique value always.
I tried with GUID.gethascode.Tostring("x") but sometimes even it creates dupilcates.
It should generate unique always.
Thanks
Kusuma
|
|
|
|
|
Well, you can't hope to create unique values in 8 characters. It's just not going to happen - look how long a GUID is.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
If you really want truly random numbers, there is a web site called www.random.org that will provide truly random numbers. On the site you can read about how the numbers are generated.
GregD (My Blog on software development)
|
|
|
|
|
Hello all,
I'm trying to add line numbers to a RTB by wrapping the RTB in a UserControl.
I move the RTB to the right to allow room for line numbers which I draw in the exposed UserControl area at the left margin. I have a property which allows me to get/set Fonts to be used for Text and Line numbers but when I do a pe.Graphics.MeasureString the numbers in the UserControl and the text don't match up for some reason?
//Code to draw line numbers in exposed UserCOntrol area
SizeF szLN = pe.Graphics.MeasureString(strLineNum, textFont);
int ln = firstVisibleLine + 1;
for (int i = 0;
(i <= lastVisibleLine) && (ln <= richTextBox1.Lines.Length);
i++)
{
pe.Graphics.DrawString(ln.ToString(), textFont, sb, pt);
pt.Y += szLN.Height;
++ln;
}
Any help on this and any other nuances with the RTB control would be of great help.
Thanks,
Mike
Theres light at the end of the tunnel. Lord I hope it ain't no train!
|
|
|
|
|
Instead of leaving a space on the left and drawing the line numbers
on the exposed area, why not to have another RTB on the left of small width
and making it similar to the background with ReadOnly=true?
Regards,
Arun Kumar.A
|
|
|
|
|
Arun,
Thanks for the tip..That would also take care of the justification of the numbers.
Thanks,
Mike
Theres light at the end of the tunnel. Lord I hope it ain't no train!
|
|
|
|
|
hi all,
I have a crystal report which has a sub report as well. now i wanna add a field in a main report and a field in the sub report and display the total.
regards
ruwandi
rkherath
|
|
|
|
|
Last night I tried to whip out a simple one form UI for one DB table, and I thought I'd use the RAD features of VS2005, simply dragging fields from my data source onto a detail edit form. All went well initially[1][^], but then I discovered a typo in a table field name in SQL, which I hastily corrected. Of course then all my generated data access code and XML in my project was broken, but I could not for the life of me find the old option of Generate Dataset, so I did a search and replace to correct the field spelling, and that's when everything went the way of the Pear. I was even getting an error that comprised solely of a message box with the number 80042729 when doing nearly any command in VS2005.
To cut a long story short, I need information on maintaining this type of project. Creating it is dead easy, that's why I did it that way, to save time, but I ended up having to drop and re-create the data source and my form to correct a spelling mistake in one field name. It can't always be this difficult.
|
|
|
|
|
Hi,
Any links to write file header and function header in c# files?
I am looking at freeware plugins/ add-ins like in VC6 to automatically insert function headers and file headers.
How easy is it to write own tools for same?
Is there any inbuilt feature for this in VS2005 which I am missing?
Thanks,
Arti Gujare
-- modified at 6:16 Friday 27th April, 2007
|
|
|
|
|
You can use snippets or modify the new class template.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
Thank you Chritian Graus.
Using the Export Template, I was able to export the template for the whole class which will surely be useful when I am writing a new class. But there are some existing class which I need to adhere to the coding standards.
This is what I want to achieve.
Open a file, Select a function, click the add-in/macro and a fucntion header in the form of XML comments should get added automatically. How can I do this?
Thanks and Regards,
Arti Gujare
|
|
|
|
|
Have you looked at GhostDoc.
http://www.roland-weigelt.de/ghostdoc/[^]
It will do some of what you want if I understand you correctly. For a file header, you could try writing a code snippet.
Kevin
|
|
|
|
|
Hi!
i want to close windows form when i click on any tree node. when i click a tree node, after_select event of tree node is called and in that After_select event i closed my current web form and opened new form but it throws following exception.
Disposed object of tree view could not be found.
I posted this question two times before also but no satisfactory answer is given. One of member suggested to use IDisposal but i m not getting how to use it. So, can anyone suggest me the solution in detailed form.
Thanx
|
|
|
|
|
EEmaan wrote: One of member suggested to use IDisposal but i m not getting how to use it
IDisposable won't help here, the issue is precisely that you close the form while some code is running, and so the control is disposed while you're trying to use it.
You're closing web forms ? Not windows forms ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
Sorry i wrote Web Form instead of Windows form. Actually i m closing windows form by using this.close();
my piece of code is like
private void TreeView1_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
{
Form2 f=new Form2();
f.show();
this.close();
}
now plz give me its solution also.
|
|
|
|
|
I do not know the exact solution:
But, see if this helps U.
Locate the line "Application.Run(new Form1());"
and enclose it within try catch.
try
{
Application.Run(new Form1());
}
catch(Exception exe)
{
}
Regards,
Arun Kumar.A
|
|
|
|