| Calling a parent class method |
|
 |
Index ‹ DotNet ‹ Visual C#.Net
|
- Previous
- 1
- Winforms >> Question on ClickOnce DeploymentI have an app which I deployed last week. If I make a change to the app and
it only affects changes to existing code. what I mean by that no new
projects/dlls, no new controls etc. What do I need to copy up to the
deployement site, just the new .exe?
Bill
- 2
- Winforms >> Richtextbox Settings problemI pasted the following code (from a Microsoft example) in the load event of my form, but when I run the app, none of the settings, such as font size, color, etc. take effect, except for the bulletted list.
' Clear all text from the RichTextBox;
rtbSetUpInstructions.Clear()
' Set the font for the opening text to a larger Arial font;
rtbSetUpInstructions.SelectionFont = New Font("Arial", 16)
' Assign the introduction text to the RichTextBox control.
rtbSetUpInstructions.SelectedText = "The following is a list of bulleted items:" + ControlChars.Cr
' Set the Font for the first item to a smaller size Arial font.
rtbSetUpInstructions.SelectionFont = New Font("Arial", 12)
' Specify that the following items are to be added to a bulleted list.
rtbSetUpInstructions.SelectionBullet = True
' Set the color of the item text.
rtbSetUpInstructions.SelectionColor = Color.Red
' Assign the text to the bulleted item.
rtbSetUpInstructions.SelectedText = "Apples" + ControlChars.Cr
' Apply same font since font settings do not carry to next line.
rtbSetUpInstructions.SelectionFont = New Font("Arial", 12)
rtbSetUpInstructions.SelectionColor = Color.Orange
rtbSetUpInstructions.SelectedText = "Oranges" + ControlChars.Cr
rtbSetUpInstructions.SelectionFont = New Font("Arial", 12)
rtbSetUpInstructions.SelectionColor = Color.Purple
rtbSetUpInstructions.SelectedText = "Grapes" + ControlChars.Cr
' End the bulleted list.
rtbSetUpInstructions.SelectionBullet = False
' Specify the font size and string for text displayed below bulleted list.
rtbSetUpInstructions.SelectionFont = New Font("Arial", 16)
rtbSetUpInstructions.SelectedText = "Bulleted Text Complete!"
Am I missing anything. I haven't done any modifications to the original code.
Thanks
- 3
- Net Framework >> Discovering exception thrown by a methodHello all,
I would like to know if there's a way to discover what exception(s) is
thrown by a function. I can imagine it is possible using reflection, but I
cannot find it.
For example:
toto instance of class Toto.
toto.myFunction(); // inside myFunction some exception are thrown, this is
what I try to figure out...
Thanks in advance.
Patrice
Thanks in advance.
Patrice
- 4
- Dotnet >> Pong Network CommsHi,
I'm looking to build a networked ( LAN ) version of Pong. Any quick
pointers on what libraries to use. Should I use Sockets ( whatever they
are) ?
- 5
- Microsoft Project >> Filters: How to filter all the task relationated with one specified taskI'm working with a project that has a planning of more than 900 tasks.
Each 7 days i need to check in detail dome tasks and its incluence in
others relationated with this.
It is possible to customize one filter that permit to see only the
tasks that are in relation with one specified task? Its means that if
I want to see the tasks that are in relation with task "A" (i.e.) I
applied the filter an then i could see the task "B" which is
relationed with task "A", and task C which is relationes with task B,
and task D which is relationed with ttask C, and so on.
This is very urgent for me, because I need to watch the schedule in
details faster.
I was trying for many many time, and i found no solution. Could anyone
help me?
- 6
- Net Framework >> Create a tab delimited text fileHi all
I have two coloumns in a excel worksheet where the first coloumn is a
header and the second coloumn is a corresponding value. Also i have a
text file That contains header and values in a tabdelimited format.
Now the requirement is like I have to compare the Headers in excel
with the headers in the text file and write the corresponding values
from the excel in the text file. Can somebody help.
Regards
Shantanu
- 7
- Visual C#.Net >> File reading problem from DVD writerHi,
I tried to write a utility for copy video file from DVD-RW Rom. When I
tried to access file from DVD-RW ROM, it trows exception "Access to
the path 'J:\VIDEO_TS\VIDEO_TS.BUP' is denied.". I tried below code
for file copy utility.
private void butCopyFile_Click(object sender, EventArgs e)
{
try
{
FileStream readFile = new FileStream(this.txtSourcePath.Text,
FileMode.Open);
FileStream writeFile = new
FileStream(this.txtDestinyPath.Text, FileMode.OpenOrCreate);
int rByte = 0;
while (rByte != -1)
{
rByte = readFile.ReadByte();
if (rByte != -1)
{
writeFile.WriteByte((byte)rByte);
}
else
{
MessageBox.Show("EOF");
}
}
writeFile.Close();
readFile.Close();
MessageBox.Show("Successful Complete!!!");
}
catch (UnauthorizedAccessException exp)
{
MessageBox.Show(exp.Message);
}
}
}
Please guide me, what I missed in code? and how I can access file from
DVD-RW?
Regards,
-aimslife
- 8
- 9
- Net Framework >> FolderBrowserDialog crashes when path is too longHi!
I'm kind of dissapointed right now :(
I've got a FolderBrowserDialog in my form, and it works fine, until I choose
a path that is over approximately 135 characters long. Then it crashes the
entire app. (Haven't got the exact count, but it works with ca. 130)
Is this behavior by design, or is it a bug? Anyway, it's really annoying.
The error that occurs is the following:
An unhandled exception of type 'System.Runtime.InteropServices.COMException'
occurred in mscorlib.dll
Additional information: Invalid access to memory location.
Any help appreciated!
Lars-Erik
- 10
- Net Framework >> upgrading .net from 1.0 to 1.1Hello
I have visual studio, that ships with framework 1.0 .
I need to upgrade this to 1.1, I downloaed the dotnetfx.exe from microsoft,
and installed it .
but this caused a lot uf bugs in my application.
After googling for a couple of days i found out that this was caused by
installation of both 1.0 and 1.1 .
Aha! I though.. lets uninstall 1.0 .. Smart.. not.. I had to reinstall
visual studio...
so now i wonder,, how can i upgrade the 1.0 that ships with vs.net to 1.1 ?
Chris .
- 11
- Visual C#.Net >> Textbox: Select Text On Tabed FocusI thought when you tabbed into a textbox that the text it contained
was automatically highlighted. This use to be the default in win32.
Is there an easy way to do this in .NET. I don't want this to happen
if the mouse is used to select the TextBox.
Seems wierd, If the Textbox has the default text in it the higlight
works but not if you edit it.
Thanks.
- 12
- Dotnet >> Dot Net Components Reviews?Folks,
Perhaps, this is a very commonly asked question. Pardon me for not being
attentive before. Is there a website/resource where I can get some reviews
on Dot Net 3rd party components. Until VB 6.0 days, I did not care if
Mabrys and Dev-Softs charged 100-150 for their suite of products and they
turned out to be lemons. However, in the dot net world, when I have to
shell out $400+ for the components, I just want to make sure, I am making
the right choice.
Any help will be greatly appreciated.
Regards.
Walt
- 13
- Visual C#.Net >> Remote Desktop Connection from c#Hi,
Is there a way to launch an remote desktop connection to a specified
server/username from c#?
If there's a way to send the password too that would be useful, but i'm
not so interested in that if its a problem.
Thanks!
Andrew
- 14
- Winforms >> Threading problem with Managed ExtensionsI have a Windows Form developed in C# using the Microsoft
Web Browser control, which is an old-style COM control.
When I run the form from a .NET application that has an
[STAThread] attribute on the startup object, it works
fine. However, when I run the same form from a C++
application using Managed Extensions for C++, I
get "Server Busy" messages when the message loop blocks. I
believe I need to indicate somehow to the Managed
Extensions that I want to run the code in an STA. How do I
do that?
- 15
- ADO >> Problem in creating sql database in visual web developer 2005 expressHi,
When I go to Add New item->Sql database-> click ADD i get the following
error.I also get the same error when i open the security page on web
site admininstration tool.
"There is a problem with your selected data store. This can be caused
by an invalid server name or credentials, or by insufficient
permission. It can also be caused by the role manager feature not being
enabled. Click the button below to be redirected to a page where you
can choose a new data store.
The following message may help in diagnosing the problem: An error
occurred during the execution of the SQL file 'InstallCommon.sql'. The
SQL error number is 1802 and the SqlException message is: CREATE
DATABASE failed. Some file names listed could not be created. Check
related errors. An unexpected error occurred while checking the sector
size for file 'U:\VISUAL STUDIO
2005\WEBSITES\APP9\APP_DATA\ASPNETDB_TMP.MDF'. Move the file to a local
NTFS volume, where the sector size can be retrieved. Check the SQL
Server error log for more information. Creating the
ASPNETDB_1e007377194340a4850801591429f1bc database"
Please help me--
Thanks
|
| Author |
Message |
KirkMarple

|
Posted: Wed Jun 29 00:01:40 CDT 2005 |
Top |
Visual C#.Net >> Calling a parent class method
I have a class (sharedClass) that is instantiated (not derived) by two other
classes (guiClassA and guiClassB). The sharedClass needs to be able to call
a method that is defined in its parent class (guiClass).
Specifically, when guiClassA or guiClassB calls a method from the
sharedClass, the sharedClass needs to log its actions by sending strings to
the guiClass (via guiClass method calls), which in turn display or record
this log information in their own unique ways.
How can the sharedClass call out a function from its parent class without
knowing exactly what kind of class the parent class is? (I can however
guarantee that the parent class will implement the logging function).
Since both guiClasses are not used in the same application, I was able to
solve this in C++ by declaring the logging function prototype in a header
file that was included by all the classes, and then defining the function
implementation at the same level as the guiClass was instantiated. Thus, the
connection was made by the linker. Is there any way to do something similar
in C#?
DotNet209
|
| |
|
| |
 |
Bruce

|
Posted: Wed Jun 29 00:01:40 CDT 2005 |
Top |
Visual C#.Net >> Calling a parent class method
I was going to suggest declaring the logging function(s) as an
interface implemented by both gui classes, but I just thought of a
better way.
Don't use methods at all. Use events. Have your sharedClass expose a
(or multiple) shared event(s). You can declare your own event arguments
and your own event handler type to carry any specialized information
you need. Whenever it needs to log anything, the sharedClass simply
raises the appropriate event.
It's then up to the enclosing guiClass to subscribe to the event(s) and
do whatever it needs to do (log the event) as appropriate.
I wouldn't even name the event according to what has to happen (don't
call it LogXXXX). Instead, I would name the event according to what
happened that was "loggable". You know: ValueChanged,
CertificateExpired, whatever. This may lead to multiple events from the
sharedClass, but this also achieves maximum decoupling, both logically
and conceptually. The sharedClass just notifies the "outside world"
when certain things happen and provides details about the event. The
guiClass is then just one interested party that happens to respond to
those events by logging them. Other classes may want to subscribe to
the events for other reasons.
So... I would use a completely different paradigm: events rather than
callbacks.
|
| |
|
| |
 |
| |
 |
Index ‹ DotNet ‹ Visual C#.Net |
- Next
- 1
- Winforms >> how to: persist the DesktopBounds with a menu?hi all
i have a form that i would like to persist its desktopbounds.
however, upon each shut down + start up of the application
and the form,
the form's bottom grows by about the size of a menu.
this is obviousely an unwanted effect.
how can i persist the desktop bounds of my form with the menu?
assaf
- 2
- ADO >> improving executenonquery timesHi,
We are new to ADO.NET, and any help would be appreciated.
The scenario is as follows: we have a large number of objects
(thousands) to write to a database. Each object has a method that
returns the SQL query which will update a relevant table in the
database.
We had opened a connection to the databse, and for each such string
did executenonquery (on that one connection). The results were
horrible. Then we had moved on to aggregating all the queries,
separated by newline in a one huge string (with StringBuilder of
course) and doing only one executenonquery per all the objects - that
was a big improvement.
Is the paradigm of doing one large executenonquery instead many small
ones, for one connection is indeed optimal ?
Is the paradigm of having one connection (instead of say, thousands,
each per object) optimal ?
Do you have any idea how the times may be improved further ? Is there
any other method ?
Alex & Misha
- 3
- Dotnet >> PropertyGrid and datatablehi
here is my question
I use a propertyGrid to display/modify values
some of my properties are in database...for exemple : a list of city
(city_id, city_text)
is it possible to give a datatable to the property and let it display in a
combobox the list of the city?
I want to display le name of the city (city_text) and want to retrieve the
id (city_id)...
in other words, is there a way to use displayMember & valueMember &
datasource in the propertyGrid????
thanks in advance
bye
lobrys
- 4
- ADO >> Progress bar doesn't incrementI created a windows form that has a progress bar on it. I am running a bunch of statements to update data on the database. I want the progress bar to increment (perform one step) after each update. The problem is that the progress bar doesn't move (it just sits there until the end) can anyone give me an example of how to accomplish this?
example:
progressBar1.Visible=true;
progressBar1.Show();
progressBar1.Maximum = 24;
progressBar1.Step = 1;
progressBar1.PerformStep();
Perform_update1;
progressBar1.PerformStep();
Perform_update2;
progressBar1.PerformStep();
Perform_update3;
etc.
thanks in advance
-Jeff-
- 5
- 6
- 7
- Visual C#.Net >> How to make SoapHttpClientProtocol create different TCP connection for web service invocation?I use VS auto generated code to invoke a internal network webservice.
The auto-generated code use class SoapHttpClientProtocol to do Soap-on-
http communication. It turns out that for single
SoapHttpClientProtocol instances, TCP connection is always maintained
for reuse. This is understandable. Now, I have one load balancer
between client and backend webservice cluster, so, single TCP
connection for single invocation is prefer-ed.
How to make it create TCP connection for one method invocation and
then close it?
Thanks,
- 8
- 9
- 10
- Visual C#.Net >> Alternative to 'abstract' in base forms?I'm creating several forms that inherit from a base form. I want to require
the derived forms to implement certain methods of the base form. The easy
solution would be to declare abstract methods in the base form. But I can't
do that, since the WinForms Designer can't instantiate an abstract form.
So, what would be a good alternative to using abstract methods. I'm thinking
about declaring an interface, but that seems kind of klunky. Thanks.
--
Dave Veeneman
Foresight Systems
- 11
- Net Framework >> Re: Question on ConfigurationElementCollection designA while back, a question was posted on ConfigurationElementCollection design as follows:
"I have 2 questions on using element collections when building a custom
section handler. I'm using the "declarative" model and I can post the code
if necessary.
My code works and the XML in app.config for my custom section looks like this:
MySection name="x"
Stores add name="store1"
add name="store2"
Stores
MySection
But I have 2 sort of "cosmetic" questions about changing the XML:
1.
...
2. In some cases it might also be nicer to skip the outermost "Stores"
element and just have this:
MySection name="x"
Store name="store1" Store name="store2"
MySection
But I don't see how to arrange for this in the declarations of a
ConfigurationElementCollection. It seems to require the outermost element to
key on its name. What I want is sort of an "unnamed" collection of Stores."
The first part of the question was answered by using the ConfigurationCollection attribute.
Did you ever get a solution to the "unnamed" part (part 2) of your question? I'd like to also add a section collection to my config section and adding a name is redundant. ie., the "Stores" element in you sample. Can an "unnamed" section be added?
- 12
- Microsoft Project >> Material Cost Input and CalculationOur Material Cost View is not acting consistently and am wondering if anyone
knows what the reason and/or fix might be.
In some instances it is working as desired where once the material resource
is assigned to a task you must enter the units into Actual Work then Actual
Cost is calculated. Entering directly into Actual Cost is blocked.
In other instances it will block from allowing input into Actual Cost on the
first input column then will allow it after that. If data is input into the
Actual Cost field Actual Work is not calculated and the 2 become out of sync.
In even other instances it allows input into Actual Cost on the first try.
The problem does not seem to be project specific either. Sometimes it works
OK on a project and other times it doesn't. I have not been able to identify
any commonality in occurance.
Thanks,
Debbie
--
Debbie P
- 13
- Dotnet >> Crytsal Reports LinesI var a report which is designed to represent a form. The detail rows need
to be seperated by lines. I am recieving mmy data accirately from a SQL
database. The report works fine; however whjen I place the line underneath
the row of fields the fields appear to be blank or covered up. in other
words all or parts of the data seem to disappear. Any ideas???
Thanks
Rick
- 14
- Microsoft Project >> Resource across projectsI'm getting there - thanks to this forum!
I now have a shared resource across 3 projects (one of which is absence,
i.e. sickness & holidays!)
If I open my resource file (in resource usage view), I can see by person,
all the work that they have done across the projects in a week (to make sure
it adds up to 35 hours) then by project I can see the progression - LOVELY
But, of course, a problem remains (!), since I receive worksheets (across
the projects) by man, I would like to be able to enter the hours worked from
the resource usage view in the shared resource file, and then have that
update the hours worked in all the projects (and consequently hours remaining
etc etc) - I don't seem to be able to do this (it doesn't have any effect,
and will not save), I have to go into each project & update them individually
(which then updates the shared resource file)
I'm sure there must be a way of doing this, all help appreciated
Thanks
--
Helen
- 15
|
|
|