|
Hi can anyone tell me that how i program's My server to output as Music/Audio to Clients Like (Radio programs). in C#.NET
Sheharyar_JH
|
|
|
|
|
You can send the audio file as binaries and then save it in the client pc by the client program ...
I am not sure but try...
|
|
|
|
|
hi all,
I want to load a Windows Form1 to a panel which is in a another form2.Can I do it?.Can I set child property to form1 and do it?
thanks in advance.
|
|
|
|
|
You can not put a top level control on a control. Please use "user controls" insted. They can be added to a panel.
|
|
|
|
|
I did something like this for a tab control. I think the same thing would work for a panel control.
Dim frm As New Form1
frm.TopMost = False 'Note this line
Me.TabPage1.Controls(0).Controls.Add(frm)
frm.Dock = DockStyle.Fill
frm.Show()
Good Luck!
Have a great day!
j2associates_NO_SPAM_@yahoo.com
|
|
|
|
|
I had a simple .NET application successfully developed and deployed to a production environment.
Out client required another application, which is slightly different from the first application.
So I basically use the first application to develop the second application. I have successfully deployed the second application in my development PC, and it works absolutely fine. So I decided to deploy the application in the production.
First I deployed the application, in a PC that the login user has the administrative rights, The application was successfully deployed and it worked perfectly.
Then I try to install the application in the work stations that the login users do not have administrative rights to their PCs. When I double click my MSI, I ended up with the following error message.
“This advertised application would not be installed because it might be Unsafe. Contact your administrator to change the installation user interface option of the package to basic.”
I tried the following options
-------------------------------
- Change the Group Policies UI option to basic.
- Tried login as an administrator that PC, and tried deploying it.
- Workstations use the Active directory, and I changed the active directory UI option to basic.
I still have the same error. Please help me this pretty urgent.
|
|
|
|
|
Hello All,
We have a custom control which inherits from ComboBox, call it CC1. It also raises a custom event. We have a second custom control which inherits from CC1, call it CC2. CC2 traps the custom event raised by CC1.
If I drag 4 of the CC2 controls onto a windows form, the CC2 custom event sub gets called 4 times instead of once. The custom event CC1 is firing 1 time for each control that exists on the form. However, it is receiving the correct CC1 object as a sender argument. What am I missing here? Thanks in advance!
Have a great day!
j2associates_NO_SPAM_@yahoo.com
|
|
|
|
|
What you are describing is correct behaviour. Each instance attaches it's own sub to it's event, and since there are four instances, four events are fired.
What exactly are you trying to do?
|
|
|
|
|
Thanks Adam! Please feel free to correct me if my terminology is not accurate, but I need an "Instance" event, not a class or type event.
As an example, if I have 5 standard comboboxes on a form and I write code to trap CombBox3's click event, I only get one event firing, right?
Is this issue because my inherited Class2 has no design surface upon which Class1 resides?
What I am trying to do is set a timer which is fired when the user clears the textbox portion of a combobox. If the timer expires and the user hasn't typed anything into the textbox portion, it is reset. I raise my custom event just before resetting the text in case I want to supply some alternate text to use.
If combobox3 was cleared, combobox3 is the object passed into the event every time it fires (I pass it as a Sender object into the Custom event). If I cannot restrict the event to only the object that actually raised it, is there any way to account for it so I don't run the same code over and over for no reason?
I really appreciate your response, this project is pushing me into some areas in which I have not worked before. Thanks!
Have a great day!
j2associates_NO_SPAM_@yahoo.com
|
|
|
|
|
Hi,
As an example, if I have 5 standard comboboxes on a form and I write code to trap CombBox3's click event, I only get one event firing, right?
Correct. You clicked ComboBox3, so ComboBox3's Click event fired - you only wired one method up to the ComboBox3.Click event.
If combobox3 was cleared, combobox3 is the object passed into the event every time it fires (I pass it as a Sender object into the Custom event). If I cannot restrict the event to only the object that actually raised it, is there any way to account for it so I don't run the same code over and over for no reason?
There's one thing that's confusing me: what do you mean by "restrict the event to only the object that raised it"? When you raise the event in your custom subclass, you pass in the current instance that raised the event ("this") as the Sender argument to your event handler. Or do you want to ensure that only one method can attach itself to an event?
|
|
|
|
|
Hello Adam,
Sorry for the delay in responding. I have been sick as a dog all week and am finally recovered enough to get back on my computer.
What is happening to me is that the custom event is being raised once for each custom object. The sender object in each case is correct, it is the object that fired the event. It just fires multiple times instead of once.
Now that I am feeling a bit better, I plan to do some more testing later today. Thanks again for your help!
|
|
|
|
|
Hi!
Sorry to hear that you've been crook - hope you're feeling better!
Because of the way objects work your custom event will be fired once for each object. This is expected and normal behaviour. If I'm not mistaken, you would like to ensure that the event only fires once - across all instances of your custom combo box no matter how many there are.
If that's the case, you could create a static private boolean variable at the class level (call it, say, "fEventFired") and whenever you need to fire your custom event perform a check on that variable. Only fire the event if it's false. Once you've fired the event once, set fEventFired = true and that will ensure it never fires again:
protected void OnCustomEvent(EventArgs e)
{
if (!fEventFired)
{
CustomEvent(this, e);
fEventFired = true;
}
}
Because the variable is static it'll be shared across all instances of your class. Bear in mind that this will mean that you won't be able to fire that event again for the duration of your application. If you needed to customize this you could always create an internal static property that get/sets the flag.
Hope this is of some use to you!
Regards,
-Adam.
|
|
|
|
|
Hello Adam,
Sorry, I apperently did not communicate too well. What I want is for the event to fire once per instance. In other words, say I have 5 custom controls on the form and the event should be raised by instance3 due to some user action with instance3. I want the event to fire once for instance3.
What is happening in the above scenario is that the event is appearing 5 times (once for each control) when it is raised by instance3.
As an example, if you have 5 standard comboboxes on a form and you are reacting to the DropDown event, if the user clicks the arrow on combobox3, the DropDown event is only fired once and only by combobox3. Even though the others have DropDown events wired, nothing happens with them.
If the above worked the same way my custom control is working, the DropDown event for combobox3 would actually happen 5 times, once for each combobox on the form.
Thanks for your continued interest and discussion!
Have a great day!
j2associates_NO_SPAM_@yahoo.com
|
|
|
|
|
Hi!
Ok, that makes perfect sense now (honest! ). To raise the event on ONLY instace 3, and it fires not only for instance 3, but 1, 2 and 4 as well (for example), when you've only manipulated instance 3.
I can now conclusively say that is quite bizarre behaviour. . Can we see some code? Specifically the code for the custom implementation of ComboBox? If it's quite long, perhaps just the event definition and the code that calls the event.
Off the top of my head I can't think of a logical explanation for this. It doesn't make sense how firing one event on one particular control causes the same event to be fired by ALL instances of that control.
-Adam.
|
|
|
|
|
I've added a tabcontrol to my C# dialog app. I set an event on one of the tabs to fire when someone clicks on the tab, but it never seems to work. I've tried other events and they do not seem to work.
Any suggestions as to what I need to do or what code to post here for help?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
You get a SelectedIndexChanged event when the selected tab changes. If you click on the tab itself at the top, the TabCtrl raises the Click event, but if you click somewhere on the page (not the tab), the TabPage raises the Click event.
See the note below the table here[^].
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
That did it. I kept trying to add the event to the individual tabs.
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
|
what are the good class generators for databases in sql server to C#, i have found some tools but which good tools do U guys recommend ?
|
|
|
|
|
CodeSmith[^] is a very good one.
Steve Maier, MCSD MCAD
|
|
|
|
|
I have used OlyMars and had good results. It produces the data access layer and very usable business components. It's beta and has some quirks in the gui but it's worth a look.
http://www.microsoft.com/france/msdn/technologies/outils/olymars/default.asp
|
|
|
|
|
Hi,
I have a series of labels named light1, light2,...
I'm in a foreach loop of a HashTable i where the indexes are named light1,light2,...
Is there a way to change the proprerty of a Label without doing something like:
foreach ( String i in backupserver.Keys ){
.
.
.
if ( i.Equals("light1" ) )
light1.BackColor= System.Drawing.Color.LimeGreen;
if ( i.Equals("light2") )
light2.BackColor= System.Drawing.Color.LimeGreen;
.
.
.
I'd like to be able to do something like:
foreach ( String i in backupserver.Keys )
{
.
.
"i".light1.BackColor= System.Drawing.Color.LimeGreen;
}
Where "i" would be translated at runtime to light1,light2...
Other than that it takes a lot of lines to have all the condition covered.
Hope someone can help!
Thanks
Pierre
|
|
|
|
|
What are the values of the Hashtable? The controls?
You could iterate through the control collection:
if (val is Label)
{
((Label)val).BackColor=Color.LimeGreen;
}
or something like that.
Marc
My website
Latest Articles:
Object Comparer
String Helpers
|
|
|
|
|
Actually, the hashtable is a machine name and a log file name as:
backupserver.Add("light1","\\\\light1\\d$\\logs\\log.txt");
.
.
.
|
|
|
|
|
I was wondering if you as a C# programmer try to keep the line width of your code under a certain number of characters.
Back in my C days, I tried to keep all lines of code within 72 characters. This wasn't hard to do. But I'm finding it impossible with C#. For one thing the .NET coding guidelines discourage abreviated names for classes, methods, events, etc. (which I understand and agree with). But more importantly, with namespaces, classes, methods, and so on, I find myself indenting further and further before I even get to the meat of the code. And it's even worse if you're trying to make the class thread safe using the lock mechanism.
To show you what I mean...
namespace SomeNamespace
{
private readonly object lockObject = new Object();
public class SomeClass
{
public void SomeMethod()
{
lock(lockObject)
{
}
}
}
}
I find it imposible in many cases to keep the code within a certain line width. I'm not complaining; I appreciate all of these constructs that make programming easier to manage and reason about. But I was just wondering what other C# programmers think about line width. What approaches do you take? Or do you just not worry about it?
|
|
|
|