| Discovering exception thrown by a method |
|
 |
Index ‹ DotNet ‹ Net Framework
|
- Previous
- 1
- 2
- Visual C#.Net >> DateTime time zone conversions not required !Would appreciate some insight into how people are dealing with the
implicit conversion of timezones that .NET does.
If a server in one timezone delivers up a typed dataset to a component
in another (winform for example) then the timezone conversion takes
place. This is a pain if you are doing date based calculations on the
client using input in one timezone and data from another. (Take one
hour off a CET time and you go a day back in terms of days...)
What are people doing to conteract this? What are some sample
strategies? Any sample code to simply STOP this would help, but I
suspect there are more far reaching implications...
Thanks
- 3
- 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.
- 4
- Visual C#.Net >> Reading in parts of an XML DataSetHi
I am experimenting with XML files that contain data sets created using
the WriteXML method available with the DataSet type.
Reading in the whole file is simple using the corresponding ReadXML
method. However, what I really want to do is simply read in the parts
of the file based on a very simple SELECT clause. I want to do this
because these files are quite large and (a) it is too slow (b) they
take up too much memory once loaded.
For example, if the dataset contained code/value pairs, can I somehow
get the code/value pairs if the code was greater than a particular
value.
I am unsure if XMLReader will do the trick?
- 5
- Winforms >> How to tell if file is text basedI want my application to load any file that is text based (php, txt, rtf,
asp, etc) - - just not any binary file
In the Open file dialog, that's easy, but I want users to be able to load
the files by drag/drop - - so therefore, I will need to check for the types
of files.
I could go through the different filetypes
if FILENAME.endswith(".txt"), etc, but that would end up being pretty
ridiculous
How can I check the file, as it comes in, as to whether it's text based or
binary?
- 6
- Net Framework >> [NET 2.0] applicationSettings section, static?Hi,
I use this new feature, but it seems that when I compile the assembly, and
copy it to another machine, the settings are kept statically.
Even using the Reload method does not have this re-read it from any .config
file.
What am I doing wrong?
This is inside app.config _and_ [assembly].dll.config (replace assembly with
the real name).
<applicationSettings>
<BLAH.Properties.Settings>
<setting name="blahsetting" serializeAs="String">
<value>blahvalue</value>
</setting>
</BLAH.Properties.Settings>
</applicationSettings>
- 7
- Winforms >> Inherited Form QuestionI created a form which I named SpreadTemplate1 and use it for others forms to
inherit from, like the form that I named frmMyCustomersVendorList. The form
frmMyCustomersVendorList as its own controls plus controls that it inherited
from SpreadTemplate1. Both have a InitializeComponent() method.
I'm getting the following warning and do not know if this is important nor
what I could do about it:
"MyCustomers.frmMyCustomersVendorList.InitializeComponent()' hides inherited
member 'OrderWizWin.SpreadTemplate1.InitializeComponent()'. Use the new
keyword if hiding was intended."
- 8
- Visual C#.Net >> what's wrong with lock(this) ?I have seen some debate but am not clear on what the problematic
implications of the expression lock(this) are. Microsoft seems to
advocate it, but others seem to be against it.
Pros and cons?
-KJ
- 9
- Dotnet >> Resizing Custom Control at Design Time?I have created a custom control, which draws a circle on the form. Now
resizing the circle at design is distorting it. When I resize it at run time,
it appears fine. How can I fix this problem thanks?
- 10
- Dotnet >> WPF: threading problemHi
Not sure how to accomplish the following, so any advice would be
appreciated.
I have an application with 5 ListViews.
Each ListView is a data-bound control. The data for each comes from
different sources (files, database, webservice) and is in the form of a
List(Of x).
What I want to do is to create 5 separate threads that each return a List(Of
x) and then bind these to the relevant grids.
The problem I have encountered is that my initial attempt failed because the
List(Of x) generated on the background worker thread and therefore can't
update the UI controls.
I'm sure there's a simple fix, but can't see it.
Thanks in advance
Griff
- 11
- Visual C#.Net >> how to get parent control of the context menu stiphi guys,
i'm working on the context menu for the controls.
the problem i'm facing right now is like this :
i want to use one context menu for more then one controls lets say i
want to use one context menu for 3 treeview controls as 3 of them
shares same type of menu.
what i'm not able to do is, i can not idetify which control has invoke
the context menu's event. let say one of the treeview control has
invoke an event "Reset" from the context menu. all i need to do is, to
find out which treeview has invoked the event and needs to refill the
treeview control.
i tried to find out how to get the parent control but i failed to do
so.
tools
c#.net 2.0 (VS.NET 2005)
can anyone give me any kind of suggestion on this.
thanks,
Lucky
- 12
- Dotnet >> Steinberg plugins, HELP Please!Hi.
Do you know a managed (.net) version of the VST Steingerg Interface, or
compiled COM Dll with needed classes
that .net programmer can use. To use this VST plugin Interface which mans to
create a plugin dll it is required to inherit from the audioeffectx or
audioeffect class, but it's in native C++ only and that's why there are so
many problems with implementing it in C# or VB.NET
Greetings,
Doker
- 13
- 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?
- 14
- ADO >> error- System.Exception: Could not create an environment: OCIEnvCreate returned -1Hi,
I encounter the following error
System.Exception: Could not create an environment: OCIEnvCreate
returned -1.
when i try to run a simple program of ASP.Net (databinding example)
that connects to an oracle database.
I have included the program:
-----------------------------------
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
'Dim strconn As String = "server=oracle;uid=system;pwd
=system;database =oracle"
Dim strconn As OracleConnection = New
OracleConnection("user id = scott;password = scott;data source =
ORACLE")
Dim strcomm As String = "select * from emp"
Dim dataadapt As New OracleDataAdapter(strcomm, strconn)
Dim ds As New DataSet
dataadapt.Fill(ds, "emp")
Dim bldr As New OracleCommandBuilder(dataadapt)
Dim dt As DataTable = ds.Tables(0)
dtemp.DataSource = dt
dtemp.DataBind()
End If
End Sub
-------------------------------
The error is at line ---> dataadapt.Fill(ds, "emp")
I do not know the reason. Kindly help me out.
- 15
- Dotnet >> PLEASE HELP: URL as a hyperlink in EventlogI'm trying to write a url as a hyperlink in the Eventlog,
does anyone know if this is possible ??
I have found the following site that confirms this can be
done, but he doesn't say how !!!
http://www.codeproject.com/dotnet/evtvwr.asp
|
| Author |
Message |
DoyleStroup

|
Posted: Sat Sep 24 12:13:20 CDT 2005 |
Top |
Net Framework >> Discovering exception thrown by a method
Hello 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
DotNet307
|
| |
|
| |
 |
Chris

|
Posted: Sat Sep 24 12:13:20 CDT 2005 |
Top |
Net Framework >> Discovering exception thrown by a method
Hi,
Unfortunately there is no reflection method to identifying the exceptions
possibly raised by a method.
To the best of my knowledge, this would require disassembly of the IL to
identify exceptions raised explicity in the method.
--
Chris Taylor
http://dotnetjunkies.com/weblog/chris.taylor
"pat" <EMail@HideDomain.com> wrote in message
news:EMail@HideDomain.com...
> Hello 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
|
| |
|
| |
 |
Nick

|
Posted: Mon Sep 26 00:53:53 CDT 2005 |
Top |
Net Framework >> Discovering exception thrown by a method
pat wrote:
> Hello 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
If you are doing this for debugging purposes you can simply use the
ToString method of the exception.
try
{
toto.myFunction();
}
catch(Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.ToString());
}
The message box will display a message where you can see what type of
exception was thrown.
You can however catch a specific exception like so.
try
{
toto.myFunction();
}
catch(NullRefferenceException ex)
{
//NullRefferenceException exceptions will be caught here
}
catch(SomeOtherException ex)
{
//SomeOtherException exceptions will be caught here
}
catch(Exception ex)
{
//the rest of the exceptions get caught here
}
Hope this helps.
Nick Z.
|
| |
|
| |
 |
Kevin

|
Posted: Mon Sep 26 10:04:03 CDT 2005 |
Top |
Net Framework >> Discovering exception thrown by a method
Hi Patrice,
Here's a set of functions I wrote for dissecting Exceptions. It is far from
complete, in that it only specifically covers about 6 Exception types, and
treats all others as System.Exception. However, it does get the type name of
the exception, the exception message, source, and details about the
Exception, and calls itself recursively to drill down through all (if any)
InnerExceptions inside the Exception. It returns all this information as a
single string with line breaks delimiting the various details. I use it to
log Exceptions, and to send emails about Exceptions. Also note, these
methods are designed for .Net Platform 2.0. If you want to use them with
earlier versions, you may need to tweak it a bit (e.g. some of the Exception
classes don't exist in earlier platforms):
/// <summary>
/// Gets Detailed Information about an Exception
/// </summary>
/// <param name="ex"><c>System.Exception</c></param>
/// <returns>Formatted Detailed Exception Informatioon</returns>
public static string GetExceptionDetails(Exception ex)
{
StringBuilder sb = new StringBuilder("");
GetExceptionDetails(ex, ref sb);
return sb.ToString();
}
/// <summary>
/// Gets Detailed Information about an Exception
/// </summary>
/// <param name="ex"><c>System.Exception</c></param>
/// <param name="sb"><c>System.Text.StringBuilder</c> passed by
reference
/// to other methods and instances of this method, for
/// building the return value</param>
/// <returns>Formatted Detailed Exception Information</returns>
private static void GetExceptionDetails(Exception ex, ref
StringBuilder sb)
{
int i;
sb.Append(sb.Length == 0 ? "" : nl);
Type t = ex.GetType();
Type[] types = new Type[] {
typeof(WebException),
typeof(SqlException),
typeof(SmtpException),
typeof(SmtpFailedRecipientException),
typeof(SmtpFailedRecipientsException),
typeof(System.Configuration.ConfigurationException)};
string TypeName = t.ToString();
// Get type of Exception
for (i = 0; i < types.Length; i++)
{
if (t.Equals(types[i]))
break;
}
sb.Append("Exception of Type \"" + TypeName + "\"" + nl);
// Handle with the appropriate handler
switch (i)
{
case 0: // WebException
GetWebException((WebException)ex, ref sb);
break;
case 1: // SqlException
GetSqlException((SqlException)ex, ref sb);
break;
case 2: // SmtpException
GetSmtpException((SmtpException)ex, ref sb);
break;
case 3: // SmtpFailedRecipientException
GetSmtpFailedRecipientException(
(SmtpFailedRecipientException)ex, ref sb);
break;
case 4: // SmtpFailedRecipientsException
GetSmtpFailedRecipientsException(
(SmtpFailedRecipientsException)ex, ref sb);
break;
case 5: // System.Configuration.ConfigurationException
GetConfigurationException(
(System.Configuration.ConfigurationException)ex, ref
sb);
break;
default:
GetSystemException(ex, ref sb);
break;
}
if (ex.Data != null && ex.Data.Count > 0)
{
sb.Append(nl + "Data:");
foreach (DictionaryEntry d in ex.Data)
sb.Append(nl + "Key: " + d.Key.ToString() +
", Value: " + d.Value.ToString());
}
if (ex.InnerException != null)
{
sb.Append(nl + "InnerException: " + nl);
GetExceptionDetails(ex.InnerException, ref sb);
}
sb.Append(nl + "StackTrace: " + nl + ex.StackTrace);
if (ex.HelpLink != null && ex.HelpLink != "")
sb.Append(nl + "HelpLink: " + ex.HelpLink);
}
/// <summary>
/// Get Details of a System.Exception
/// </summary>
/// <param name="ex"><c>System.Exception</c></param>
/// <param name="sb">reference to a <c>System.Text.StringBuilder</c>
/// building the Exception string</param>
public static void GetSystemException(Exception ex, ref StringBuilder sb)
{
sb.Append(nl + nl + ex.Message);
if (ex.Source != null)
sb.Append(nl + "Source: " + ex.Source);
}
/// <summary>
/// Get Details of a SqlException
/// </summary>
/// <param
name="ex"><c>System.Data.SqlClient.SqlException</c></param>
/// <param name="sb">reference to a <c>System.Text.StringBuilder</c>
/// building the Exception string</param>
public static void GetSqlException(SqlException ex, ref
StringBuilder sb)
{
int i;
sb.Append(nl + nl + "ErrorCode: " + ex.ErrorCode.ToString());
sb.Append(nl + "Line Number " + ex.LineNumber.ToString());
sb.Append(nl + "Error Number " + ex.Number.ToString());
sb.Append(nl +"Procedure Name: " + ex.Procedure);
sb.Append(nl + ex.Message);
if (ex.Errors.Count > 0)
{
sb.Append("nl + Errors: " + nl);
for (i = 0; i < ex.Errors.Count; i++)
{
sb.Append(nl + "Line Number " + ex.Errors[i].LineNumber.ToString());
sb.Append(nl + "Error Number " + ex.Errors[i].Number.ToString());
sb.Append(nl + "Procedure Name: " + ex.Errors[i].Procedure);
sb.Append(nl + ex.Errors[i].Message);
}
}
}
/// <summary>
/// Gets Details of a WebException
/// </summary>
/// <param name="ex"><c>System.Net.WebException</c></param>
/// <returns>String containing exception details</returns>
public static string GetWebException(WebException ex)
{
StringBuilder sb = new StringBuilder("");
GetWebException(ex, ref sb);
return sb.ToString();
}
/// <summary>
/// Get Details of a SqlException
/// </summary>
/// <param
name="ex"><c>System.Data.SqlClient.SqlException</c></param>
public static string GetSqlException(SqlException ex)
{
StringBuilder sb = new StringBuilder("");
GetSqlException(ex, ref sb);
return sb.ToString();
}
/// <summary>
/// Get Details of a WebException
/// </summary>
/// <param name="ex"><c>System.Net.WebException</c></param>
/// <param name="sb">reference to a <c>System.Text.StringBuilder</c>
/// building the Exception string</param>
private static void GetWebException(WebException ex, ref
StringBuilder sb)
{
sb.Append(nl + nl + ex.Message);
sb.Append(nl + ex.Response.ResponseUri.ToString());
sb.Append(nl + "Status: " + ex.Status.ToString());
}
/// <summary>
/// Get Details of a SmtpException
/// </summary>
/// <param name="ex"><c>System.Net.Mail.SmtpException</c></param>
/// <param name="sb">reference to a <c>System.Text.StringBuilder</c>
/// building the Exception string</param>
private static void GetSmtpException(SmtpException ex, ref
StringBuilder sb)
{
sb.Append(nl + nl + ex.Message);
sb.Append(nl + ex.StatusCode.ToString());
}
/// <summary>
/// Get Details of a ConfigurationException
/// </summary>
/// <param
name="ex"><c>System.Configuration.ConfigurationException</c></param>
/// <param name="sb">reference to a <c>System.Text.StringBuilder</c>
/// building the Exception string</param>
private static void GetConfigurationException(
System.Configuration.ConfigurationException ex, ref
StringBuilder sb)
{
sb.Append(nl + ex.BareMessage);
sb.Append(nl + "Details:" + nl + ex.Message);
sb.Append(nl + "FileName: " + ex.Filename);
sb.Append(nl + "Line Number: " + ex.Line.ToString());
}
/// <summary>
/// Get Details of a SmtpFailedRecipientException
/// </summary>
/// <param
name="ex"><c>System.Net.Mail.SmtpFailedRecipientException</c></param>
/// <param name="sb">reference to StringBuilder building the Exception
string</param>
private static void
GetSmtpFailedRecipientException(SmtpFailedRecipientException ex, ref
StringBuilder sb)
{
sb.Append(nl + nl + ex.Message);
sb.Append(nl + ex.StatusCode.ToString());
sb.Append(nl + ex.FailedRecipient);
}
/// <summary>
/// Get Details of a SmtpFailedRecipientsException
/// </summary>
/// <param
name="ex"><c>System.Net.Mail.SmtpFailedRecipientsException</c>c></param>
/// <param name="sb">reference to StringBuilder building the Exception
string</param>
private static void
GetSmtpFailedRecipientsException(SmtpFailedRecipientsException ex, ref
StringBuilder sb)
{
sb.Append(nl + nl + ex.Message);
sb.Append(nl + ex.StatusCode.ToString());
for (int i = 0; i < ex.FailedRecipient.Length; i++)
sb.Append(nl + ex.FailedRecipient[i]);
for (int i = 0; i < ex.InnerExceptions.Length; i++)
{
sb.Append(nl + "InnerException[" + i.ToString() + "] -");
sb.Append(nl + GetExceptionDetails(ex.InnerExceptions[i]));
}
}
--
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
I'd rather be a hammer than a nail.
"pat" <EMail@HideDomain.com> wrote in message
news:EMail@HideDomain.com...
> Hello 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
|
| |
|
| |
 |
Patrice

|
Posted: Mon Sep 26 10:38:10 CDT 2005 |
Top |
Net Framework >> Discovering exception thrown by a method
Nope. This is just in the documentation. Else you'll have to decompile the
code.
Not aware of the details for this design but there's likely here a
"phylosophical" difference compared with Java.
--
Another Patrice
"pat" <EMail@HideDomain.com> a écrit dans le message de
news:EMail@HideDomain.com...
> Hello 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
|
| |
|
| |
 |
| |
 |
Index ‹ DotNet ‹ Net Framework |
- Next
- 1
- 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
- 2
- 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?
- 3
- 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
- 4
- 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
- 5
- 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
- 6
- Visual C#.Net >> Calling a parent class methodI 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#?
- 7
- 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) ?
- 8
- 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 .
- 9
- 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
- 10
- 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
- 11
- 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
- 12
- 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
- 13
- 14
- 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
- 15
- 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
|
|
|