|
Hi ,
I am trying to add a WindowsMediaPlayer Control in my app so that the user can play the audio file from my app page ! I have added the ref to WMPLib.dll.
My code is as follows:
AxWMPLib.AxWindowsMediaPlayer newMedia = new AxWMPLib.AxWindowsMediaPlayer();
ResourceManager resources = new ResourceManager(typeof(testControl));
newMedia.OcxState = ((AxHost.State)(resources.GetObject("newMedia.OcxState")));
newMedia.Enabled = true;
newMedia.Location = new Point(tX, tY);
newMedia.Name = tName;
newMedia.Size = new Size(tW, tH);
thisPanel.Controls.Add(newMedia);
if (tDefault != null) newMedia.URL = tDefault;
newMedia.URL = @"c:\myfile.mp3";
The last line newMedia.URL = @"c:\myfile.mp3" results in InvalidActiveXStateException. I know the filename is correct as I can play it from Explorer.
Any suggestions !?!
Thanks,
Paul
|
|
|
|
|
In ASP (Code behind module) I'm tring to so a simple assignment of a dropdownlist value to an int but it can't convert the string to int. So how would I cast this?
<br />
dgResult.PageSize = ddlPageResults.SelectedValue;<br />
I tried (INT) but that's C++ I couln't do the ToInt32 either it didn't look like. I know this is super simple but I couln't find an aswer.
|
|
|
|
|
Try converting the string to int with the Int32.Parse() method.
|
|
|
|
|
Hi,
you can try:
<br />
try {<br />
int MyInt = Convert.ToInt32(MyString);
}<br />
catch(Exception ex)<br />
{<br />
}<br />
Good Luck !
Braulio
|
|
|
|
|
I have Data in a typed DataSet and a Form to Edit it.
First Time I edit the Data with the form everything works fine. But if I want to reedit the Data, as I first changes something by the form everything freezes, means that I can't change data in any Control on the form. Even the OK, Cancel Buttons doesn't work anymore. I have to exit by the Close Button of the Form.
Any Ideas?
|
|
|
|
|
hi,Does anyone know how to spread text over columns in a listview in c#?
THIS is EASY IN C++ .you ONLY have TO SET the SetItemData Method of the CListCtrl to 0.
IF you WANT text TO BE DISPLAYED IN COLUMNS SET SetItemData to 1.
example:
m_ListCtrl.SetItemData(0,0); //this lines makes text spread over columns
m_ListCtrl.SetItemData(0,1); //text to be displayed column by column
how can this be accomplished in c#?
thanks
|
|
|
|
|
I personally haven't worked with ListView controls in C#, but I did a quick search in MSDN and found a property called "Tag" in the ListViewItem class which may serve your purpose.
Regards,
Alvaro
Hey! It compiles! Ship it.
|
|
|
|
|
Has anybody determined how to set the cursor to a wait cursor during a long operation where Application.DoEvents() is being called (and thus allowing .NET to reset the cursor to that set for the control the cursor is currently over).
The only solution I have found is to set the current cursor of every control to the wait cursor, but what a pain.
Thanks - Joel
VssConnect - Remote SourceSafe(r) Access http://www.voxcode.com[^]
|
|
|
|
|
Hi.
i have a few checkboxes on my form and i want to show a simple messagebox when one of those checkboxes are checked. how can i do this dynamically?
for instance, instead of writing an if statement per checkbox, like this:
if(checkbox1.checked = true)<br />
{<br />
MessageBox.Show("checked");<br />
}
write it dynamically, like this:
(the <selected checkbox=""> is the name of the selected checkbox)
if(<selected checkbox>.checked = true)<br />
{<br />
MessageBox.Show("checked");<br />
}
i know this is pretty easy for all you guru friends out there.
Thanks,
.gonad.
|
|
|
|
|
I'm not sure if I understand you, but you can maybe use first parameter of your event handler method (sender). You have to set same function as event handler for all checkboxes.
private void checkBox1_CheckedChanged(object sender, System.EventArgs e)
{
CheckBox checked=(CheckBox)sender;
}
i'm only pointer to myself
|
|
|
|
|
Hi.
Thanks for your help. this worked exactly as you said, but i do have a queston.
Can you explain what the
(CheckBox)sender
is specifying? also, can i use this for a textbox, or other controls, as well? for example,
TextBox tb = (TextBox)sender;
I'm new at this stuff, can't you tell?
Thanks again.
.gonad.
|
|
|
|
|
First parameter (sender ) of event handler is affected object.
it is passed as object so you need to cast it to correct type (Button / CheckBox etc..).
So when you have event handler for Button, sender is button user clicked on. If you have event handler for TextBox, sender is this TextBox.
i'm only pointer to myself
|
|
|
|
|
I create tables called "Employers", "Employees". One employer can have many Employees, but one employee can have only one employer.
In my code: I create EmployerClass
{
public Long EmployerID;
public EmployeeCollections Employees;
....
}
I want the EmployeeCollections can have a group of employees order by last name and first name. I can access it like Employees[i](int i) or Employees[name](string name = lastname+" "+firstname).
Can anyone please tell me how to do that?
Thanks in advance!
|
|
|
|
|
I want to populate a winforms treeview control from a relational table without xml in c#.net. I am new to c#, so please bear with me. I set up the oracle connection, dataadapter, fill etc. The code is given below.
My problem is that I have put messagebox and see that
this.treeView1.Nodes.Add(nodeAuthor); seems to add the nodes, but when the program completes and displays the form, I do not see the group_desc populated at all. I did not add anything manually in the Nodes property in Treeview. Please help!!!
this.treeView1 = new System.Windows.Forms.TreeView();
this.oracleConnection1 = new System.Data.OracleClient.OracleConnection();
this.oracleDataAdapter1 = new System.Data.OracleClient.OracleDataAdapter();
this.oracleConnection1.ConnectionString = "the connection strings"; string strSQLAuthors = "SELECT GROUP_MASTER.GROUP_DESC " +
" FROM " +
"GROUP_MASTER ORDER BY GROUP_MASTER.GROUP_DESC ";
TreeNode nodeAuthor;
DataSet ds;
//Create the Connection and the DataSet object, and then open the connection.
ds = new DataSet();
oracleConnection1.Open();
oracleDataAdapter1 = new OracleDataAdapter(strSQLAuthors, oracleConnection1);
oracleDataAdapter1.Fill(ds, "GROUP_MASTER");
//Populate the TreeView from the DataSet.
foreach (DataRow rowAuthor in ds.Tables["GROUP_MASTER"].Rows)
{
nodeAuthor = new TreeNode();
nodeAuthor.Text = rowAuthor["GROUP_DESC"].ToString();
this.treeView1.Nodes.Add(nodeAuthor);
}
//Clean up.
ds.Dispose();
oracleDataAdapter1.Dispose(); oracleConnection1.Close();
oracleConnection1.Dispose();
ram
|
|
|
|
|
Hi,
I want to format several edit boxes, one to show the "." for currency, another one to enter phones number with an +XX-XX-XX-XX, it's possible to do that in an easy way ? ( control, input an output).
Friend of mine say... should be... I can make it with VBA for Ms Access... it should be possible an easy with C#...
|
|
|
|
|
I just submitted a new article that converts my Validating Edit Controls[^] code to C#. Hopefully it will be published soon, but I can email it to you if you need it right away.
Regards,
Alvaro
Hey! It compiles! Ship it.
|
|
|
|
|
Hey That was just what I was looking for !!!! Thanks a lot !!
Braulio
PS.: Alvaro Mendez, con este nombre me parece que hablas español no ? yo soy de Málaga (España)
|
|
|
|
|
You're welcome Braulio, I just sent it your way.
PS. Si, hablo español (mejor que lo escribo). Naci en Cuba y radico en el sur de la Florida (USA).
Saludos,
Alvaro
Hey! It compiles! Ship it.
|
|
|
|
|
Sorry, I forgot to ask you to send me the article ( you can send it to bdiez@holtegroup.com ).
Thanks for your help
Braulio
|
|
|
|
|
Hello,
I apologize if this has already been discussed, but I need to find an solution for this problem. I have several web services that I have developed, and deployed to my staging and production environments. The problem is whenever I test the web services by specifying the .asmx file, type in the parameters into the form, and click submit, the new window opens for the web service, but the port number is automatically input into the URL. This causes a time out because the service cannot be found when the port number is specified. I need to know how to set up my web services/servers to not specify the port number. If I type the URL into the address bar, without the port, the web service funtions correctly.
|
|
|
|
|
Hi all, I have been battling to send packets ( custom structures in my case ) over TCP. What is the best way to do this. Sending text is a breeze, but trying to send packaged info is proving to be a problem.
Any help welcome, thanks
|
|
|
|
|
Why dont you try Remoting (it has a TCP channel option)? And you can send entire objects across the network.
HTH
Smitha
You are never given a wish without also being given the power to make it true. You may have to work for it, however.
-- Richard Bach
|
|
|
|
|
I shall have a look at it, thanks
|
|
|
|
|
hi, id like to know how to code for a button on a splash window, the button is an ok button..when clicked opens the main menu window...at this moment i've done this :
private button OK_CLICK (and so on......)
{
Application.Run(new MainMenu());
}
but this code is giving me errors..
is there any other way...the correct way....im new to C#...
thx alot
15 Yr old
|
|
|
|
|
If your splash dialog is started by a Main routine,
and your MainMenu is just a form, then you should code your button like this:
<br />
MainMenu mm = new MainMenu(this);<br />
mm.ShowDialog();<br />
the MainMenu will then be displayed as a modal dialog (i.e. the user can't interact with
the original dialog -the splash screen- until (s)he closes the MainMenu).
I'm not sure how you can then close the splash form, but that's a start, I hope.
F.O.R.
|
|
|
|