|
I would say that's not always the case. Sometimes, you may want to create a class that has most of its base class' functionality, but not allow derived classes access to the base class' version of a given method. I've never personally run into a situation like that, but I could see it happening.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
It happens all the time when deriving from System.Windows.Forms.Control for instance. In fact most (if not all) of the controls provided hide some base methods and properties.
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
Hide them so they can't be used/accessed?
|
|
|
|
|
MS do it all the time - they mark them as Obselete , throw NotSupportedException s as well as the standard EditorBrowsableState.Never and Browsable(false) etc... I agree - against OOP principles but as they included so much functionality in such classes there is little choice.
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
That violates basic OOP principles.
|
|
|
|
|
Yeah, I suppose it does, and like I said, I've never done it myself, but that wasn't really the guy's question.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
If you mark it as obselete then it cannot be used.
If it is in a separate assembly that is added as a reference to the dll (not a project reference) then the EditorBrowsable attribute will hide it so it doesn't show in intellisense.
[EditorBrowsable(EditorBrowsableState.Never),
Obsolete("This method is obselete")]
public new void Func()
{ }
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
Hello,
I am trying to create a script that will list the tables in an Access database and put them into a list box. The code I am using (below) seems to be correct as far as it goes, but instead of listing the name of the tables, it returns the following string for each row[System.Data.DataRow]. I am obviously missing something here. Any suggestions are appreciated. Thank You, Pat
string Constr = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source= " + Application.StartupPath + @"/" +
textBoxAccessFile.Text + ";Jet OLEDB:Database Password= " + textBoxAccessPassword.Text;
OleDbConnection Conn = new OleDbConnection(Constr);
try
{
Conn.Open();
DataTable dt = Conn.GetSchema("tables");
Conn.Close();
for (int i = 0; i < dt.Rows.Count; i++)
{
listViewDbTables.Items.Add(dt.Rows[i].ToString());
}
}
catch (Exception ex)
{
MessageBox.Show("Error: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
|
|
|
|
|
It make sence to have that result because you are calling the ToSting() on a DataRow object and
it returns the type of the object eg System.Data.DataRow
Have a look here.
I bug
|
|
|
|
|
Yes, I saw several examples there, but they were all different and I did not know which one to use. I tried 2 of them and could not get them to work. Finally, I used part of the code from another reply with your suggestion and I got it to work correctly. I have posted the finished code in the other reply in case you, or others, would like to see it. Thank you for your assistance. I am marking your reply as a good answer as well since it sent me to the right spot and helped me to derive the working code. Thank you, Pat
|
|
|
|
|
listViewDbTables.Items.Add(dt.Rows[i].ToString());
I guess you want to retrieve the value:
dt.Rows[i][?].ToString(), ? should be int or string.
|
|
|
|
|
Yes, thank you. I wanted the name of the table. I did not exactly understand your code at first, but after combining it with some other reply's, I was able to get the code below that is working. Accordingly, I thank you again for your help and have marked this answer as correct.
Best Regards, Pat
string Constr = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source= " + Application.StartupPath + @"/" +
textBoxAccessFile.Text + ";Jet OLEDB:Database Password= " + textBoxAccessPassword.Text;
OleDbConnection Conn = new OleDbConnection(Constr);
try
{
string[] restrictions = new string[4];
restrictions[3] = "Table";
Conn.Open();
DataTable dt = Conn.GetSchema("tables",restrictions);
Conn.Close();
for (int i = 0; i < dt.Rows.Count; i++)
{
listViewDbTables.Items.Add(dt.Rows[i][2].ToString());
}
}
catch (Exception ex)
{
MessageBox.Show("Error: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
|
|
|
|
|
I've many controls created on runtime but they haven't added in any parent control. The problem is that, I've bound their properties but they never change until the control get visible or I manually call DataBinding.ReadValue().
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
modified on Thursday, June 17, 2010 8:59 PM
|
|
|
|
|
Got another way...Control didn't help.
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
hello,
i'm programming a small game.
in the background should run a thread that plays background music.
in another thread there are running the soundeffects.
when i run my project everything works.
my system is win7 64bit.
when the same project is run under a win7 32bit machine the mci player can't find the device.
the alias (guid) is correct), any idea how to fix it?
BackgroundMusic = new MCIPlayback(Properties.Settings.Default.SOUNG_MUTE);
BackgroundMusic.Open(soundFilePath, "mpegvideo");
BackgroundMusic.Play();
private String alias;
public MCIPlayback(bool m)
{
muted = m;
this.alias = Guid.NewGuid().ToString("N");
}
public void Open(string file, string type)
{
this.alias = Guid.NewGuid().ToString("N");
name = file;
string cmd = "open \"" + name + "\" type " + type + " alias \"" + alias + "\"";
int errCode = mciSendString(cmd, null, 0, IntPtr.Zero);
if (errCode == 0)
isOpen = true;
CheckError(errCode);
}
public void PlayNewTrack(string file)
{
Stop();
Open(file, "mpegvideo");
Play();
}
public void mute()
{
muted = true;
Pause();
}
public void Play()
{
if (muted)
{
Pause();
return;
}
if (!isOpen)
return;
string cmd = "play \"" + name + "\"";
int errCode = mciSendString(cmd, null, 0, IntPtr.Zero);
CheckError(errCode);
}
}
i have no clue, thx!
p.s.
the error code is
MCIERR_INVALID_DEVICE_NAME 263
modified on Thursday, June 17, 2010 6:15 PM
|
|
|
|
|
fixed it myself
name != alias !!!!
replace name for alias and it works.
don't know why, i thought you have go give it the file it should play, but i think when
u open a file in a special mci with his unic id(alias). later you have to say the player (alias) that it should react
|
|
|
|
|
Hi all!
I have an application which provides the user with an option to start my application automaticly at windows startup (using the registry HKEY_CURRENT_USER\Software.....\Run) and this works excellent; whenever a user wants to run the application at startup I simply create the registry entry and everything works fine.
However if the user wishes to un-install my application the registry key will still be present in the registry.....
Does anyone have a good idea how to remove the registry key during un-install? (I use the built-in VS Installer Project)
Thanks!
|
|
|
|
|
Create a custom action for the uninstall that removes the value
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi.
Thanks for the quick reply. I have tried to create custom actions but without success (I'm not really sure how to do this). Would you please provide an example on how to do this?
Sorry for the "extra work"....
|
|
|
|
|
|
Again, thanks for the quick reply!
I guess I should have informed about the following: I'm a total newbie in computer programming in general. I have tried to search google (and codeproject) for solutions to my problem and I've indeed found many examples on how to create custom installations/un-installations.....
My problem is that these examples are either too complicated for me to understand, or too general for me to be able to use for my specific problem.
Maybe I'm a "lost case" since I cannot uderstand the existing examples on the internet, but if any of you have the time to help me with this I would really appreciate it (either with a specific example on how to resolve my problem, or a very (VERY) simple example on how to solve something similar).
Again, what I want to do is to remove one registry entry during un-installation.
|
|
|
|
|
Kaare Tragethon wrote: My problem is that these examples are either too complicated for me to understand, or too general for me to be able to use for my specific problem.
And you expect us to provide you something different? Or perhaps you want one of us to write it for you?
Kaare Tragethon wrote: I'm a total newbie in computer programming in general.
Then perhaps this task is above head at the moment and you should be working on other projects to build your skills first.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Sorry for bothering you guys.
|
|
|
|
|
Hey i am a new programmer and i am having some problems with SAPI. I have two button click events that suppose to read the content of a text block but on one works. So i dont know whats up with that. See code below.
SpeechSynthesizer _speechSynthesizer;
private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
{
_speechSynthesizer = new SpeechSynthesizer();
_speechSynthesizer.Speak(Text1.Text);
}
private void Button2_Click(object sender, System.Windows.RoutedEventArgs e)
{
_speechSynthesizer = new SpeechSynthesizer();
_speechSynthesizer.Speak(Text2.Text);
}
|
|
|
|
|
Some thoughts:
- Are you sure that
Button2_Click() is being called?
- Does a breakpoint in the method get hit?
- Have you confirmed that
Text2 is in fact the text box that contains the text?
/ravi
|
|
|
|