Hi team,
What is Difference between ADO.net and Entity Framework?
In real time applications, When(in what cases) we should use ADO.net and Entity Framework?
Hi team,
What is Difference between ADO.net and Entity Framework?
In real time applications, When(in what cases) we should use ADO.net and Entity Framework?
<disclaimer> I already posted this question in the VSTO forum, an admin referred me to this forum </disclaimer>
All, I searched for hours on the web, without luck, and finally decided that I need your help.
Here's what I want to achieve:
The user copies a cell (or a range), say A3, and - when she hits a button - I need to get access to the address of the cell (to create a link) programmatically.
Accessing the clipboard in text format is easy:
string clip; if (Clipboard.ContainsText()) clip = Clipboard.GetText();
I also found that it is possible to access the clipboard in different formats, like this
var dataObj = Clipboard.GetDataObject(); var format = DataFormats.CommaSeparatedValue; if (dataObj != null && dataObj.GetDataPresent(format)) { var csvData = dataObj.GetData(format); //... }
but I couldn't for the life of me find which format contains the link and how to get it. (I cycled through all formats offered by Clipboard.GetDataObject().GetFormats(), but some returned inscrutable streams I couldn't make sense of.
Background info:
A. The Link must be there, because I can use "paste link" which creates an absolute reference
B. I'm using Excel 2010 and VS2010 - C# under Win7
C. The code runs in a custom task pane
There seems to be an option to access the clipboard as "XML worksheet", sample code below.
However, the resulting document seems to represent a worksheet without any reference to the original source, including the address where it was copied from.
var dataObject = Clipboard.GetDataObject(); var mstream = (MemoryStream)dataObject.GetData("XML Spreadsheet"); mstream.SetLength(mstream.Length - 1); var rdr = new System.IO.StreamReader(mstream); var xml = XElement.Load(mstream);Obviously, as a "workaround" I can use
Application.ActiveCell.Addressto get the address. But this is not the ideal thing. The functionality I am working on shall ultimately work with a lot of other applications, not just Excel alone. From a usability point of view, the clipboard would be the single uniform mode supported in all these apps.
Furthermore, the "ActiveCell" is specific to the ActiveWorksheet. With this "workaround" I can never refer to cells not at the current worksheet, which is a serious limitation.
Any help most appreciated!
Protected Sub Upload_Click(ByVal sender As Object, ByVal e As EventArgs) Dim UploadTo As String = "ftp://mydomain.com/test.txt" Dim ftp As FtpWebRequest = DirectCast(WebRequest.Create(UploadTo), FtpWebRequest) ftp.Credentials = New System.Net.NetworkCredential("username", "password") ftp.KeepAlive = True ftp.Method = WebRequestMethods.Ftp.UploadFile Dim file() As Byte = System.IO.File.ReadAllBytes(Server.MapPath("/test.txt")) Dim stream As System.IO.Stream = ftp.GetRequestStream() stream.Write(file, 0, file.Length) stream.Close() stream.Dispose() Response.Redirect("/") End Sub
Hello,
I have an VB.NET app that I'm maintaining that relies on the SystemEvents.PowerModeChanged event firing to disconnect from back end services. I created a simple test application which works fine when you sleep or hibernate a computer on Windows 8 desktop or Windows 7, however when I run this on a Surface 3 it never fires when I click the Sleep button.
Imports Microsoft.Win32 Public Class Form1 Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load AddHandler SystemEvents.PowerModeChanged, AddressOf SystemEvents_PowerModeChanged End Sub Public Sub SystemEvents_PowerModeChanged(ByVal sender As Object, ByVal e As PowerModeChangedEventArgs) System.Windows.Forms.MessageBox.Show("Power Mode Changed") End Sub End Class
Does anyone know if there is any way to get this event to fire on Windows 8 on Surface 3's?
Thanks.
Hi,
I have a problem with the Danish characters. The GetValue() method returns null on that particular property which name consists of special characters from the Danish language. However, if I remove the special character, then GetValue() works fine. Can anybody help on this please.
Using .NET 4.0 in VS 2012, VB.NET
Here is the beginning code:
Dim watcher As New FileSystemWatcher() watcher.InternalBufferSize = 16384 watcher.Path = "D:\Imports" watcher.IncludeSubdirectories = True watcher.NotifyFilter = (NotifyFilters.LastAccess Or NotifyFilters.LastWrite Or NotifyFilters.FileName) watcher.Filter = "*.*" AddHandler watcher.Changed, AddressOf OnCreated watcher.EnableRaisingEvents = True
Here is the event handler:
Private Sub OnCreated(source As Object, e As FileSystemEventArgs) End Sub
THe e as FileSystemEventArgs will show the type of change, like Created or Changed, but there is no property in e to show the filter used, like LastWrite.
How can I view the filter in event handler?
Thanks
MisterT99
I'm using the Windows Media Player ActiveX control. It all works fine and dandy except for one thing. I do not want the user to be able to double click on the playback window, which causes the video window to display full screen.
I have tried inheriting from AxWindowsMediaPlayer and then overriding WndProc to ignore the WM_LBUTTONDBLCLICK and other mouse click window messages. This hasn't worked, unfortunately. Although I can capture the WM_LBUTTONDBLCLICK message and ignore it by not calling base.WndProc has no effect on whether the video displays full screen.
I have also tried overriding the "fullScreen" property and calling base.fullScreen = false, thereby ignoring whatever value was being set. This also hasn't worked.
Is there any possible way I can do this? I thought about having a timer set fullScreen to false at some interval, but I don't like that solution one bit.
Any help will be greatly appreciated!
Hi
I have tried to Process.Start exe file by using relative path like this "./notepad.exe" (starting with slash)
But, the FileNotFound exception has occurred, in the fact it exists indeed.
Instead of "./notepad.exe" , when calls the Process.Start with ".\notepad.exe"(starting with back slash), it starts successfully.
The question is that Process.Start can not accept relative path starting with slash ?
Env: Windows 7, VS 2010
Thank you very much.
Hi all,
I am trying to use UriBuilder to parse service address, using constructor as defined in http://msdn.microsoft.com/en-us/library/vstudio/y868d5wh(v=vs.100).aspx :
public UriBuilder( string uri )
Documentation remarks:
This constructor initializes a new instance of the UriBuilder class with the Fragment, Host, Path, Port, Query, Scheme, and Uri properties set as specified in uri.
If uri does not specify a scheme, the scheme defaults to "http:".
But if the uri string is in the form of "hostname:port", default scheme is not added.
Test app:
class Program { static void Main(string[] args) { TestUriBuilderFromString("http://msdn.microsoft.com/"); TestUriBuilderFromString("https://msdn.microsoft.com"); TestUriBuilderFromString("msdn.microsoft.com/"); TestUriBuilderFromString("msdn.microsoft.com:8080/"); TestUriBuilderFromString("localhost:1234/"); Console.ReadLine(); } private static void TestUriBuilderFromString(string uriStr) { var uri = new UriBuilder(uriStr).Uri; Console.WriteLine("Absolute URI from '{0}': '{1}'", uriStr, uri.AbsoluteUri); } }
Test app output:
Absolute URI from 'http://msdn.microsoft.com/': 'http://msdn.microsoft.com/' Absolute URI from 'https://msdn.microsoft.com': 'https://msdn.microsoft.com/' Absolute URI from 'msdn.microsoft.com/': 'http://msdn.microsoft.com/' Absolute URI from 'msdn.microsoft.com:8080/': 'msdn.microsoft.com:8080/' Absolute URI from 'localhost:1234/': 'localhost:1234/'
Am I missing something? Is it a correct behaviour, and if it is, are there workarounds to add default scheme ("http://") when the uri string is in the form of "hostname:port"?
Best regards,
Ivan
Hi everyone,
I have made an app for a client which does some automation on a website of a stakeholder to get some data from it. Basically, I put a code into a textbox on the website, then an element appears (from Javascript I guess). I then extract the data from that element. When the data has loaded, if you click anywhere else, the element containing the data disappears - just by design I think.
The problem is that when my app runs on XP, it just doesn't pull the data through because the element no longer contains data. It does work as intended on Windows 8 though.
In XP, the browser, for some reason is losing focus or something within the browser is losing focus and the element is vanishing.
Does anyone have any idea why this would happen in XP and not on Windows 8? Its annoying because theres nothing in the code which says 'change the focus' or anything like that. It's just deciding on its own to lose focus... I'm really at my wits end with it and I need help!
Pleaaaaaaase!! :-)
:D
Hi
can any one share ebook or material for exam 70-533-Implementing-Microsoft-Infrastructure-Solutions
Hi,
My WPF application is using MEF.
It's works well but when I package it to an App-V package, it's seems that MEF couldn't retrieve MEF export attributes.
It will result an exception "System.ComponentModel.Composition.ImportCardinalityMismatchException: No exports were found that match the constraint"
ls there some restrictions or special settings to use App-V for a MEF application?
I'm just wondering if it's possible to remove a command line parameter of a running process.
The reason behind this: My application can be started with parameters like /username:abc /password:xyz
The Windows Task Manager and other software (like Process Explorer) can visualize running processes and their command line arguments. If the process is running on a machine with several users logged in simultaneously then other users could possibly see the
password. Therefore if my process was started with a /password parameter I'd like to remove it so that it's not visible in Task Manager.
Thanks for any ideas,
Guido
Recently I found that we were releasing our application with some Debug versions of our assemblies. So I wrote a tool to detect debug versions base off of this article - http://ardalis.com/determine-whether-an-assembly-was-compiled-in-debug-mode . After fixing all the assemblies that were in our control, I found that we had a Microsoft.Web.Infrastructure assembly that was also in debug mode. I verified this by using this tool from codeplex - http://assemblyinformation.codeplex.com/
Tracking it down, we have a ASP.NET MVC 3 Web Application Project that references the assembly in C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies, which gets installed by ASP.NET Web Pages with Razor Syntax ( http://www.microsoft.com/en-us/download/details.aspx?id=15979 )
Is there a release version of this assembly out there somewhere? Why does the ASP.NET Web Pages installer release with a debug version? Will the debug version cause any problems?
Typically I would be worried about the Debug because it's not optimized, but using the codeplex tool it appears that the assembly is "Debug" & "Optimization"
I am hosting my web application into godaddy.com.
If i write whole code inside single page then it works fine but if i make it modular and try to use namespace my class library then this error comes.
Error on this page : http://cartelsolution.com/4.5.1/cartelsolution/school/Login.aspx
Description: An error occurred during the compilation of a resource required to service this request. Please review the
following specific error details and modify your source code appropriately.
Compiler Error Message: CS0246: The type or namespace name 'CartelServices' could not be found (are you missing a using directive
or an assembly reference?)
|
If i use my namespace by using CartelServices; then i get same error.
Hello to everyone :D
well some days ago i have been reading some information about c#, well after that i decided to make a Mp3 player,
i have read a lot of information for the "timer" but i haven't made it...
well nowadays i want to make the trackbar works together with the timer. it's means when i move the trackbar and the timer show me the time's music in a label right. i have the code for the trackbar! i have synchronized my trackbar with the music it means when i move the trackbar the music works very well,
but i haven't found the other code for the "TRACKBAR works together with TIMER"
To be honest i had made a "stopwatch" but it didn't work very well, when i compiled the code!.
thanks for all the answer.
thanks you for take the time to answer me :)
Best Wishes
Hello All,
General Scenario
I've been coding a simple chat application. It is supposed to transfer some data from FrontEnd Client (connected to Client's UI) to BackEndClient (created automatically by the chat's Server) via tcp protocol.
Fine.
One typo of the messages is some Connected Message, it includes all the relevant data about the User.
The Error
When I try to decerialise the firs message and to check if it is a connected message...
public void WaitForHandshake()And on the line connectedMessage = _formatter.Deserialize(_stream) as ConnectedMessage;I've got a big punch into my face, since I am told that
An unhandled exception of type 'System.NullReferenceException' occurred in ChatBasicSample.BL.dllWhere I am wrong with my code?
40yo novice
General Scenario
I am coding a chat application; one of the application's tasks is to get the message from FrontEnd Client to BackEnd Client.
I am reading the message on BackEnd side with this code:
_waitForMessagesThread = new Thread(() =>
{
Thread.CurrentThread.Name = "Client's thread for listening to the objects";
while (true)
{
BaseMessage message = _formatter.Deserialize(_stream) as BaseMessage;
I send the message with this peace of code:
The Error:
I am told that the Binary Header is not valid and the message perheps has been modified.
What is to be done?
40yo novice
Hi,
I have the following code
void Main() { var a = new A(); a.Foo(1); a.Foo(0); } public enum MyEnum { None = 0, One = 1 } public class A { public void Foo(MyEnum en) { Console.WriteLine("MyEnum"); } } public static class Extention { public static void Foo(this A o, int x) { Console.WriteLine("int"); } }I expect "int int" as result, but I got "int MyEnum". Is it compiler bug or some design feature?