Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all 8156 articles
Browse latest View live

NuGet NU1001 Dependency could not be resolved Solution

$
0
0

I was having problems with my IEnumerable variables saying that they could not find their extensions, so if you find yourself uninstalling and reinstalling NuGet packages than your nuget.config file might be corrupted.

Go to your C:\User\[YourUsername]\AppData\Roaming\NuGet folder and simple delete the NuGet.Config file. Close Visual Studios than launch Visual Studios.

If you found this form helpful upvote me and everyone else in the form as well than post what your problem was and how you resolved it.  That way we can bring others into the LIGHT and out of the DARKNESS.


MSDN jbeen19


Uninstall visual studio professional 2015

$
0
0

hi everyone

I uninstalled the product but when I tried to re-install it says can't install product is already installed.  I did a restore to

get vs professional 2015 back on.  Does anyone know how to get everything uninstalled for visual studio professional 2015

thx for any help

debug into .net source code mscolib.dll

$
0
0

When I debug the .net soucre code ,I found a question ,that is I can not step into the source code .My code is below :

string path =@"F:\CS\_Assembly\ClassLibrary1\bin\Debug\MyAssemblyName.dll";Assembly ass =Assembly.LoadFile(path);

the breakpoint is line " Assembly ass = Assembly.LoadFile(path);";

And I have found the reason ,it is because thie mscorlib.pdb is a public sysmbol, How can I get the private sysmbol?

Close all the window using code. Some of

$
0
0
My application is desktop Form application. There're many windows opened form my main window. I met problem when I try to close some of them. Please suggest me how to close all opened/hidden/minimized child windows of a process.  I cannot use Process.CloseMainWindow() alone to do this. After closing all the windows, I want to exit that process. How can I do this? The only choice is to use  Win32 API? 

westinghouse خدمة اصلاح و صيانة وستنجهاوس 01060037840 وكيل صيانه وستنجهاوس 0235699066

$
0
0

الرائدون فى مجال صيانة الاجهزة المنزلية , مصر

توفر شركة صيانة وستنجهاوس الصيانة والتجديد للاجهزة

ارقام اتصال وستنجهاوس  : 0235682820

المحمول  : 01223179993

            01154008110

            01210999852 

          01060037840

ثلاجات وستنجهاوس  ,ثلاجة وستنجهاوس  , ثلاجات وستنجهاوس  , ثلاجة وستنجهاوس  ,ديب فريزر وستنجهاوس  ,ايس ميكر وستنجهاوس  ,ثلاجات وستنجهاوس  ,ايس ميكر وستنجهاوس  ,

 westinghouseثلاجة

westinghouseثلاجات

westinghouseديب فريزر

westinghouseثلاجات 

westinghouseثلاجات

مركز صيانة وستنجهاوس يغطى مناطق ( القاهرة الكبرى ) للاصلاح بالمنزل

تعد واحدة من اكبرشركات الصيانة فى مصر (  صيانة  وستنجهاوس الاولى فى مصر )

نحن نعتمدعلى تصليح وستنجهاوس الاجهزة المنزلية الاولة فى مصر

مجموعة شركات وستنجهاوس احدى الشركا ت الرائدة فى مجال (  صيانة ثلاجات  وستنجهاوس & صيانة ثلاجات وستنجهاوس & صيانة ديب فريزر وستنجهاوس & صيانة ايس ميكر وستنجهاوس & صيانة ثلاجات وستنجهاوس & صيانة ثلاجات وستنجهاوس & صيانة ثلاجات  وستنجهاوس ، صيانة ثلاجات صحون وستنجهاوس & صيانة ايس ميكر وستنجهاوس )

الصيانة تشمل الجهاز بالكامل (( الصيانة الشاملة))

westinghouse  maintenance , repair westinghouse

0235699066 || 01223179993 || 01154008110 || 01210999852 || 0235710008

عناوين صيانة  وستنجهاوس  عناوين صيانة وستنجهاوس  عناوين صيانة وستنجهاوس عناوين صيانة وستنجهاوس عناوين صيانة وستنجهاوس عناوين صيانة وستنجهاوس عناوين صيانة وستنجهاوس عناوين صيانة وستنجهاوس عناوين صيانة وستنجهاوس عناوين صيانة وستنجهاوس عناوين صيانة وستنجهاوس عناوين صيانة وستنجهاوس عناوين صيانة وستنجهاوس عناوين صيانة وستنجهاوس عناوين صيانة وستنجهاوس عناوين صيانة وستنجهاوس عناوين صيانة وستنجهاوس عناوين صيانة وستنجهاوس عناوين صيانة وستنجهاوس عناوين صيانة وستنجهاوس عناوين صيانة وستنجهاوس عناوين صيانة وستنجهاوس

رقم تليفون وستنجهاوس  01210999852                رقم تليفون وستنجهاوس 01060037840

 رقم تليفون وستنجهاوس 01154008110                  رقم تليفون وستنجهاوس 01223179993

 رقم تليفون وستنجهاوس 0235699066                   رقم تليفون وستنجهاوس 0235682820

 رقم تليفون وستنجهاوس 0235710008                   رقم تليفون وستنجهاوس  01210999852

خدمة اصلاح و صيانة وستنجهاوس  خدمة اصلاح و صيانة وستنجهاوس خدمة اصلاح و صيانة وستنجهاوس خدمة اصلاح و صيانة وستنجهاوس خدمة اصلاح و صيانة وستنجهاوس خدمة اصلاح و صيانة وستنجهاوس خدمة اصلاح و صيانة وستنجهاوس خدمة اصلاح و صيانة وستنجهاوس خدمة اصلاح و صيانة وستنجهاوس خدمة اصلاح و صيانة وستنجهاوس خدمة اصلاح و صيانة وستنجهاوس خدمة اصلاح و صيانة وستنجهاوس خدمة اصلاح و صيانة وستنجهاوس خدمة اصلاح و صيانة وستنجهاوس خدمة اصلاح و صيانة وستنجهاوس خدمة اصلاح و صيانة وستنجهاوس خدمة اصلاح و صيانة وستنجهاوس

وكيل وستنجهاوس حدائقالهرم ,توكيل وستنجهاوس الرماية , توكيل وستنجهاوس الجيزةالجديدة

اصلاح ثلاجات وستنجهاوس  , مراكز صيانة وستنجهاوس  , اصلاحو صيانة وستنجهاوس  , توكيل صيانة وستنجهاوس  ,الوكيل صيانة وستنجهاوس  , وكيل وستنجهاوس  ,خدمة وستنجهاوس  ,ارقام وستنجهاوس  , اقرب وستنجهاوس  , اصلاح وستنجهاوس  ,افضل صيانة وستنجهاوس  ,اجود صيانة وستنجهاوس  ,الاول وستنجهاوس  , المتقدم وستنجهاوس  ,ارشادات صيانة وستنجهاوس ,وكلاء صيانة وستنجهاوس  ,الوكلاء وستنجهاوس  ,الوكالة وستنجهاوس  ,خدمةاصلاح ثلاجات وستنجهاوس  ,الرئيسى وستنجهاوس  ,اعمال صيانة وستنجهاوس  ,

 

وكيل وستنجهاوس حدائق الهرم ,توكيل وستنجهاوس الرماية , توكيل وستنجهاوس الجيزة الجديدة

اصلاح ثلاجات وستنجهاوس  , مراكز صيانة  وستنجهاوس  , اصلاح و صيانة  وستنجهاوس  , توكيل صيانة وستنجهاوس  ,الوكيل صيانة  وستنجهاوس  , وكيل وستنجهاوس  ,خدمة وستنجهاوس  ,ارقام وستنجهاوس  , اقرب وستنجهاوس  , اصلاح وستنجهاوس  ,افضل صيانة وستنجهاوس  ,اجود صيانة  وستنجهاوس  ,الاول وستنجهاوس  , المتقدم وستنجهاوس  ,ارشادات صيانة وستنجهاوس ,وكلاء صيانة  وستنجهاوس  ,الوكلاء وستنجهاوس  ,الوكالة وستنجهاوس  ,خدمةاصلاح ثلاجات وستنجهاوس  ,الرئيسى وستنجهاوس  ,اعمال صيانة وستنجهاوس  ,

تعد خدمة الدعم الفنى من احدث خدمات شركة وستنجهاوسwestinghouse agentوكيل وستنجهاوس

اسرع تحقيق الصيانة الجيدة وستنجهاوس &افضل ارشادات صيانة وستنجهاوس &نقوم بتقديم خدمة الصيانة الفورية وستنجهاوس &الجودة هى العنصرالاساسى فى صيانة وستنجهاوس الجيزة &

westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse westinghouse

تتعهدمجموعة شركات (  صيانة  وستنجهاوس  ) بتقديم اجود خدمة وتقديم اعلى مستوى من التدريب

اعلى كفائة صيانة وستنجهاوس  ( مركز صيانة  وستنجهاوس  ) FRIGIDAIRE

حيث اننا المركزالوحيد فى مصر || 0235699066 || 01060037840 || 0235682820 || 01210999852 {  صيانة  وستنجهاوس  }

مع تحيات ادارة توكيل صيانة وستنجهاوس

نعلم سيادتكم عملاء وستنجهاوس بأن الشركة قامت بفتح هذه الفروع لخدمة وستنجهاوس فى انحاء القاهرة الكبرى

 

صيانه وستنجهاوس الزمالك , صيانه وستنجهاوس المهندسين , صيانه وستنجهاوس المعادى , صيانه وستنجهاوس الدقى , صيانه وستنجهاوس العجوزة , صيانه وستنجهاوس الهرم , صيانه وستنجهاوس  6 اكتوبر , صيانه وستنجهاوس الشيخ زايد , صيانه وستنجهاوس فيصل , صيانه وستنجهاوس العمرانية , صيانه وستنجهاوس شبرا ,صيانه وستنجهاوس المقطم , صيانه وستنجهاوس النزهة ,صيانه وستنجهاوس حدائق الهرم , صيانه وستنجهاوس كورنيش النيل , صيانه وستنجهاوس الجيزة , صيانه وستنجهاوس المريوطية , صيانه وستنجهاوس القطامية , صيانه وستنجهاوس الضاهر , صيانه وستنجهاوس غمره وصيانه وستنجهاوس العباسية , صيانه وستنجهاوس مدينة نصر , صيانه وستنجهاوس مصرالجديدة وصيانه وستنجهاوس روكسى , صيانه وستنجهاوس عين شمس , صيانه وستنجهاوس الزيتون , صيانه وستنجهاوس القبة , صيانه وستنجهاوس حمامات القبة , صيانه وستنجهاوس حدئق القبه , صيانه وستنجهاوس الساحل , صيانه وستنجهاوس شبرا مصر , صيانه وستنجهاوس وداى حوف , صيانه وستنجهاوس المنيل , صيانه وستنجهاوس المنيب , صيانه وستنجهاوس امبابه , صيانه وستنجهاوس جسر السويس , صياة وستنجهاوس عابدين , صيانه وستنجهاوس جاردن سيتى , صيانه وستنجهاوس باب اللوق , صيانه وستنجهاوس باب الشعرية , صيانه وستنجهاوس زهراء المعادى , صيانه وستنجهاوس حلوان , صيانه وستنجهاوس التعاون , صيانه وستنجهاوس بولاق ابوالعلا , صيانه وستنجهاوس ماسبيرو , صيانه وستنجهاوس اغاخان شبرا , صيانه وستنجهاوس الوراق , صيانه وستنجهاوس الكتكات , صيانه وستنجهاوس وسط البلد , صيانه وستنجهاوس التحرير , صيانه وستنجهاوس رمسيس , صيانه وستنجهاوس ميدان الجيزة , صيانه وستنجهاوس القلعه , صيانه وستنجهاوس منشية البكرى , صيانه وستنجهاوس المطرية , صيانه وستنجهاوس الاميرية , صيانه وستنجهاوس الاهرام , صيانه وستنجهاوس المبتديان , صيانه وستنجهاوس القص رالعينى , صيانه وستنجهاوس الملك الصالح , صيانه وستنجهاوس مصر القديمة , صيانه وستنجهاوس بولاق , صيانه وستنجهاوس ميت عقبه , صيانه وستنجهاوس كورنيش المعادى , صيانه وستنجهاوس كورنيش النيل , صيانه وستنجهاوس الاوبرا , صيانه وستنجهاوس عزبة النخل , صيانه وستنجهاوس ارض الجولف , صيانه وستنجهاوس النزهه الجديدة , صيانه وستنجهاوس الماظه , صيانه وستنجهاوس الرحاب , صيانه وستنجهاوس مدينتى , صيانه وستنجهاوس القاهرة الجديدة , صيانه وستنجهاوس التجمع الخامس , صيانه وستنجهاوس الحوامدية , صيانه وستنجهاوس البحوث , صيانه وستنجهاوس الاورمان , صيانه وستنجهاوس حدائق حلوان , صيانه وستنجهاوس كارفور , صيانه وستنجهاوس هايبر , صيانه وستنجهاوس حدائق المعادى , صيانه وستنجهاوس طره , صيانه وستنجهاوس المعادى القديمة , صيانه وستنجهاوس كورنيش المعادى , صيانه وستنجهاوس المطبعه , صيانه وستنجهاوس

توكيل وستنجهاوس  , صيانة  وستنجهاوس  ,مركز صيانة وستنجهاوس  , صيانة ثلاجات وستنجهاوس  ,توكيل وستنجهاوس فى مصر , توكيل وستنجهاوس الوكيل الرسمى ,ثلاجات وستنجهاوس  ,  صيانة ثلاجات  وستنجهاوس   , وستنجهاوس مصر , ثلاجات  وستنجهاوس  , ثلاجات وستنجهاوس  , شركة وستنجهاوس  , ثلاجة وستنجهاوس  , فريزر وستنجهاوس  ,ثلاجات وستنجهاوس  ,ايس ميكرات وستنجهاوس  , اصلاح ثلاجات وستنجهاوس  , اصلاح ثلاجات وستنجهاوس  , الصيانة  وستنجهاوس ,خدمة اصلاح وستنجهاوس  , جودة خدمة وستنجهاوس  ,دليل اصلاح وستنجهاوس  ,خدمة وستنجهاوس السريعة , اصلاح وستنجهاوس القياسى ,مركزاصلاح وستنجهاوس  , وستنجهاوس  صيانة موجهه ,تصليح اجهزة وستنجهاوس  , صيانة منتجات وستنجهاوس  ,ضمان صيانة وستنجهاوس  ,خلية صيانة  وستنجهاوس  ,اعمال صيانة  وستنجهاوس  ,اصلاح وتشغيل وستنجهاوس  , صيانة لوحة المفتاح وستنجهاوس  ,اصلاح اعطال وستنجهاوس  ,تعليمات صيانة  وستنجهاوس  ,ضمان صيانة وستنجهاوس  ,اصلاح اجهزة وستنجهاوس  ,

 

0235699066||01154008110||0235710008 ||01060037840 || 01210999852

Windows Server 2012 Error message

$
0
0

Hi

We have an application running on multiple Windows Server 2012 virtual machines. The same version of the application runs properly on all machines except one. On running we get repeated .NET runtime error messages in the Windows Event Viewer.

Application: Vsop.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: exception code c0000005, exception address 6C3A23B7
Stack:

I checked the windows crash dump and can observe the message-

"the thread tried to read from or write to a virtual address to which it does not have access".  

I couldn't find a reason for this behaviour on one specific system. Can someone provide a few pointers on the reason or resolution ?

Thanks !!

Renaming entry in ZIP file

$
0
0

Is there a way to use Framework libraries (such as, ZipArchive or ZipFile) to renames file(s) in the archive without having to extract the content?

Thread pool Vs TPL

$
0
0

I would like to know is there any performance benefit TPL over Threadpool in C#.Which one is better in performance wise????

can anyone suggest me....

regards

latheesh


Latheesh K Contact No:+91-9747369936


How to set volume to X value

$
0
0

Hi,

I would like to ask how can I set the windows volume to X value? let's say I want to set it to 50?

Thanks,

jassim

Adding references to .NET Core projects

$
0
0

Hi.

Can anyone explain "reference adding strategy" for .NET Core projects?

Here is what I'm trying to do in VS 2015: I have a web project (MVC6), everything looks understandable there, it works. But I want to create some logic inside separate libraries and reference them in the web project.

1) Database entities library. I create a "Class Library (Package)" project and first thing I wanted to do is to add DataAnnotations reference. Initially project.json has such config:

"frameworks": {"net451": { },"dotnet5.4": {"dependencies": {"Microsoft.CSharp": "4.0.1-beta-23516",
        ..."System.Threading": "4.0.11-beta-23516"
      }
    }
  }

If I use GUI in a regular way (right-click References, add reference to System.ComponentModel.DataAnnotations), it changes "net451":

"frameworkAssemblies": {"System.ComponentModel.DataAnnotations": "4.0.0.0"
      }

But after adding using to it, project doesn't compile: "The type or namespace name 'DataAnnotations' does not exist in the namespace 'System.ComponentModel' (are you missing an assembly reference?) Lib..NET Platform 5.4"

By trial and error I managed to get it work by adding "EntityFramework.Core": "7.0.0-rc1-final" to the "dotnet5.4" "dependencies" section.
But why did I have to add that dependency?

2) Again about DataAnnotations. Another way I managed to project compiled was replacing "dotnet5.4" with "dnxcore50".

In this case adding "EntityFramework.Core": "7.0.0-rc1-final" worked but also "EntityFramework.Commands": "7.0.0-rc1-final" worked too.

Again I don't understand the idea behind it. Also, is it "bad" to use "dnxcore50" in Class Library?

3) Another Class Library has to work with IO and Sockets, and I need to use classes like Stream and TcpClient. And here trial and error didn't help, I couldn't add necessary references to bring TcpClient class.

Again References -> Add Reference added line "System.Net": "4.0.0.0" to "net451", but compilation gives an error: "Error CS0234 The type or namespace name 'Sockets' does not exist in the namespace 'System.Net' (are you missing an assembly reference?) Lib..NET Platform 5.4"

So again the question is how to find correct references?

For example, inside MVC6 project I can easily get all that stuff (DataAnnotations, TcpClient) out of the box.

4) There are also more general questions that are bothering me:

What is the best practice in runtime/framework/package version selection? That "beta-23516" doesn't look nice.

And why does MVC6 project lists all packages inside separate "dependencies" JSON node, but Class Library project has "dependencies" inside "dotnet5.4"?

Return a string value

$
0
0

Hello,

Hi want to return a string value from a class. Here is the code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;


    public class FileUp
    {
        

        public string FileUp()
        {
                       
                OpenFileDialog opendialog = new OpenFileDialog();

                DialogResult result = opendialog.ShowDialog();
                if (result == DialogResult.OK) // Test result.
                {
                     return  opendialog.FileName;
                    
                }

           
        }
        
    }

It gives an error: " FileUp.FileUp()": not all code paths return a value.  Someone can tell me which is the problem???

Thanks

Microsoft EDGE - Security certificate required to access this resource is invalid

$
0
0

We are getting following error in Microsoft EDGE in our Dev environment when we run our ASP.NET Application Hosted in IIS 8 in Windows 2012 R2 Server.

Error: XMLHttpRequest: Network Error 0x800c0019, Security certificate required to access this resource is invalid.

Following are more details about implementations and environments. Our application runs on 2 different secured ports (HTTPS). In IIS both apps are hosting as different Web Applications and using same certificate. The certificate is generated using OpenSSL SHA2 encryption and it has been added in Secured Certificate Store.

From Microsoft EDGE when we first load our application, it issues certificate warning message, and we are allowing to proceed. Once page is loaded, on a button click we are calling an API using AJAX call and that is hosted on different port.

In EDGE it is not allowing to proceed that API and giving above mentioned error.

In Chrome and IE 11 also, we are getting same warning message but from there it is allowing to execute next API.

Any help would be appreciated to fix the issue.

Thanks,

Chetan

How to get Windows Login credentials using C#.Net?

$
0
0

Hi,

 

How can we get Windows logged in user credential using C#.NET API?

 

Do we have any API to get the current User login and password ?

 

Thanx in advance,

yagnesh

Application using .NET Remoting stops communicating on Windows 7

$
0
0

Hi, I'm new to the msdn forums.  If I make a mistake then kindly guide me.

I am having a problem with a vendor's application at my company.  The application, per the vendor, is using ".NET Remoting" for server/client communication.  The client should send the server a request to update and the server will respond. I am not familiar with .NET Remoting at all, so I apologize if I cannot provide any more detail. This application works fine on WinXP, but notFULLY on Win7.  By "fully," I mean that the application works for X amount of time and then stops refreshing.  It seems like the amount of time before refreshing stops is random. I haven't seen any dropped packets when I've sniffed...it seems as if the client just stops requesting the updates.

I'll try to include as much information as I have about our setup.  I have access to part of the code but it doesn't look like the part which handles to communication...this application is proprietary so vendor is short on details.

Server:

-Windows 2003 Server R2 Standard SP2

-.NET Framework 3 SP1

-Runs the service to which the client connects via TCP/IP

Client:

-Windows 7 Pro SP

-.NET Framework 4.5.2

-.NET Framework 3.5 is turned ON in Windows Features

-MSMQ is turned ON in Windows Features (one suggestion in another forum)

-Application is set to Run as Admin & Compatibility WinXP SP2

-Firewall is OFF

-Application has been run in both Program Files & Program Files (x86)

Please, any help is appreciated!  Also, ask any questions!

MVC HtmlHelper ListBoxFor and ListBox MultiSelectList Bug

$
0
0

The HtmlHelper.ListBoxFor and HtmlHelper.listBox methods have a design bug.  A very frustrating and annoying bug, as no error is thrown, it simply doesn't correctly display the selected values.

I'm not looking for an answer, as I've already figure it out.  I'm posting so others don't have to spend hours debugging.

Simply put, whomever designed these HtmlHelpers messed up.

Here is what you need to know and understand.

1) The selectedValues parameter must be populated with a collection of key values only.  It cannot be a collection of the selected objects, as the HtmlHelper does not apply the dataValueField to this collection for you.

2) If using the ListBox you cannot set the name parameter the same as a Model property.  Also you cannot name the ViewBag property that will contain the collection of items the same as the Model property.

3) If  using the ListBoxFor it gets even more wonky.  You should name the ViewBag property that will contain the collection of items the same as the Model property name.  Now when you use the ListBoxFor within the View you must use a ViewBag property that does not exist (this is important!).  The HtmlHelper.ListBoxFor will look automatically for a ViewBag property with the assigned Model property name.

Code Example below;

public class Student
{
 public string Id { get; set; }
 public string Name { get; set; }
 public Student(string id, string name) {
  this.Id = id;
  this.Name = name;
 }
}

public class Room {
 public List<Student> Students { get; set; }
}

public ActionResult() {
 var students = new List<Student>() {
  new Student("1","test1"),
  new Student("2","test2"),
  new Student("3","test3")
 }

 var room = new Room();
 room.Students = students.Skip(2).Take(2);

 // Make sure the selected list only contains the Ids.
 var selected = room.Students.Select(s => s.Id);

 // Make sure the ViewBag property is the same name as the Model property.
 this.ViewBag.Students = new MultiSelectList(students, "Id", "Name", selected);

 return View(room);
}

// In the View
@model Room

@Html.ListBoxFor(m => m.Students, this.ViewBag.JustMakeUpANameHere as MultiSelectList)

I've tested this scenario.  It's strange, but it works.  So for those of you losing your hair trying to figure out why it refuses to preselect the selected items, now you know how to workaround the issue.


Breakdown large string of email addresses into string array of email addresses

$
0
0

Hi folks,

I have a large string of email address.

String longString = "john@john.com peter@peter.com  mike@mike.com   dave@dave.com"

Each email address is separated with a space (usually 1, but could be 2 or more as above )

I want to split up the email addresses and insert them into an array String [] strArray

Is there a quick way of doing this with a built in string function or do I have to run a for loop and check for spaces and so on..

John



jppnn

PageSettings.PrintableArea not reflecting printer capabilities

$
0
0

I'm printing to a pre-printed form, so objective location matters.  I'm trying to reach .15 in margins.  Using 2 printers I'm dealing with as examples.

With an HP 1320, using a PCL5 driver, I get a printable area {X=25,Y=16.66667,Width=800,Height=1066.667}; the same printer using a PCL6 driver, the printable area is {X=16.66667,Y=16.66667,Width=816.6667,Height=1066.667}.  I believe the PCL6 is accurately reflecting the printer's capability.  If I use wordpad to find the min-margins, I get the same results as .Net.  (I don't have a PCL6 driver for Win7, only an old XP machine, so no solution)

With a Canon IR1730if, I get a printable area {X=25,Y=25,Width=800,Height=1050}.  I know it can print farther than that.  Using it as a copy machine, it gets to about .07 in margins.  Trying to print outside of the printable area (negative values or >800/1050) shows nothing (as expected).  If I use wordpad on this printer, it gives 0,0,0,0 as min-margins (everything outside the ~.07 in isn't printed, as expected, but it does print closer than .25).  Printing to a PDF, then printing the PDF allows me to print outside of the .25inch PrintableArea.

I've tried changing about every property on both the physical printer and installed printer with no resolution.

I don't know how .Net determines the PrintableArea, so I'm not sure where to go next.  Is there a device property or system call or something that can be tweaked so the PrintableArea accurately reflects the limits of the printer, Or am I stuck hoping driver developers play fair?  Is there some other printing method that isn't bound by same restrictions; afterall, Adobe and Wordpad can reach the correct margins?

TextFieldParser cannot reliably return the LineNumber

$
0
0

The TextFieldParser class is a fantastic component for reading CSV files. However it has a flaw regarding LineNumber.

If the CSV file contains blank lines, there is no way to reliably get the LineNumber where data came from, particularly for the last line.

The LineNumber property holds the line number of the row where the parser will look for data on the next call to ReadFields. However, if there are blank lines, then they will be skipped over by ReadFields before returning the result. So checking before calling ReadFields is no good.

After calling ReadFields, the LineNumber is already advanced beyond the source of the row (in contradiction to the example provided on the MSDN docs for TextFieldParser.LineNumber). One could potentially just subtract 1 from this number, except if it was the last row, then the line number holds -1. So it's actually impossible to get the line number of the last row, if it was preceeded by blank spaces.

using System;
using System.IO;
using Microsoft.VisualBasic.FileIO;
...
string csv = "\r\nline2\r\n\r\n\r\nline5";
var reader = new StringReader( csv );
var parser = new TextFieldParser( reader )
{
    Delimiters = new [ ] { "," }
};
Console.WriteLine( parser.LineNumber );           // gives 1
Console.WriteLine( parser.ReadFields( ) [ 0 ] );  // gives "line2"
Console.WriteLine( parser.LineNumber );           // gives 3
Console.WriteLine( parser.ReadFields( ) [ 0 ] );  // gives "line5"
Console.WriteLine( parser.LineNumber );           // gives -1

// In this example, the field-value shows the actual
// line number that the data appeared on.
// But it is not possible to retrieve this from the LineNumber
// property, either before or after ReadFields is called


It would be good if TextFileParser could have an option to not automatically skip blank lines and/or have a property to get the LineNumber of the last row read.

parser.ReadFields() -> ["Line4"]

parser.LineNumber -> 5

Recognize variables of another method

$
0
0

Hi!

In the code below I have a class and three public methods inside. In the first method I have created an object called opendialog (is in bold) . In the second one, I have a string variable also in bold, folderNa. My problem is that the third method doesn´t recognize "opendialog" and "folderNa". How can I declare them in the third method???  Thanks.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;


    public  class FileUpload
    {

        public string browseDoc(string file)  //FIRST METHOD
        {

            OpenFileDialogopendialog = new OpenFileDialog();

            DialogResult result = opendialog.ShowDialog();

            if (result == DialogResult.OK)
            {

                file = System.IO.Path.GetFileName(opendialog.FileName);

                return file;
            }
            else
            {
                return null;
            }
        }

            public string browseFolder(string folderNa)  //SECOND METHOD
        {

        FolderBrowserDialog fold = new FolderBrowserDialog();

        DialogResult result = fold.ShowDialog();

        if (result == DialogResult.OK)
        {
folderNa = fold.SelectedPath;
            return folderNa;
        }
        else
        {
            return null;
        }

        }

        private void uploadFile(string selectedFile)  //THIRD METHOD
        {

            int count = 0;
            string[] FilenameName;
            foreach (string item inopendialog.FileNames)
            {
                FilenameName = item.Split('\\');
                File.Copy(item,folderNa+ FilenameName[FilenameName.Length - 1]);
                count++;
            }
            MessageBox.Show(Convert.ToString(count) + " File(s) copied");
        }
    }

                                               

Visual Studio 2015, C#, What has changed with AppDomain.CurrentDomain.GetAssemblies().

$
0
0

After migrating my project from VS 2013 to VS 2015 - I am faced with a few object reference errors.

I will identify the problem alongwith an example.

I have two classes, with the same name StatusList - they are under different namespaces.

a. TestNS.Interop.Cache.CacheItems

b. TestNS.Interop.Enquiry

namespace TestNS.Interop.Cache.CacheItems
{
 public class StatusList
 {   
   public string Message { get; set; }   
   public StatusList()   
   {        Message = "I am a cache statuslist"; }
 }
}

namespace TestNS.Interop.Enquiry
{
 public class StatusList
 {
    public string Message { get; set; }
    public StatusList()
    {
        Message = "I am an enquiry statuslist";
    }
 }
}   

The main program makes a call to AppDomain.CurrentDomain.GetAssemblies() and looks for the first StatusList.

var manyitems = AppDomain.CurrentDomain.GetAssemblies().SelectMany(o => o.GetTypes()); var typeServerCacheItem = manyitems.FirstOrDefault(o => o.Name == name);

class Program
{   
   static void Main(string[] args)   
   {            PrintMessagefromAssembly();    }   
   private static void PrintMessagefromAssembly()    {       
     const string name = "StatusList";       
     var manyitems = AppDomain.CurrentDomain.GetAssemblies().SelectMany(o => o.GetTypes());       
     var typeServerCacheItem = manyitems.FirstOrDefault(o => o.Name == name);       

     if (typeServerCacheItem == null)       
      {     Console.WriteLine("No item found");           
return;       
      }       
Console.WriteLine(typeServerCacheItem.FullName);        Console.ReadKey();   
     }
}

If you perform a clean and build for this project using VS2013 the typeServerCacheItem returned is the class under CacheItems.

If you perform a clean and build using VS 2015 the typeServerCacheItem returned is the class under Enquiry.

I do realize that the code should be fixed, there is a logical error in the code - a filter criteria should exist for CacheItems. However I am trying to understand what changed with the way AppDomain.CurrentDomain.GetAssemblies() works?

Many Thanks Rajesh

Viewing all 8156 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>