Quantcast
Channel: Visual Studio General Questions forum
Viewing all 21115 articles
Browse latest View live

Problem with floating point arithmatics

$
0
0

Hi all,

Could anyone shed a light on this?

According to my calculator, if i do (100/43) * 22 = 51.162....

However the code below outputs 44.00 (limited to 2 decimal places).

What am i doing wrong, please?

Regards

Francesco C

 double fraction = (100/43);
              double percentage =fraction*22;
              Console.WriteLine ("{0:F2}",percentage);

//Console outputs 44.00



Visual Studio Multi-Project Template Customization

$
0
0

I am writing a multi-project template and I would like to customize it as described below.

When project templates are used, the solution file (*.sln) is typically placed in the directory specified by the user in the 'New Project' dialog. I would like to override this behavior and place the solution file one level lower, e.g. in a directory named 'Source'. For example, if the directory specified in the dialog is 'D:\Dev\MyCustomSolution', I would like the solution file, and project directories,  placed in 'D:\Dev\MyCustomSolution\Source'. I want to use this feature with a multi-project template that contains projects (*.csproj) and other files, e.g. configuration, executable, etc. Some of these other files need to be placed in the specified directory, e.g. 'D:\Dev\MyCustomSolution', rather than 'D:\Dev\MyCustomSolution\Source'.

Not able to sign-in to Visual studio 2019 community edition

$
0
0

As Visual studio community version 2019 is free, So I installed it and at the time of installation I didn't sign-in. Now it is showing your 30 day trial period is over. Now I am trying to sign-in with microsoft account but it is throwing error page which displays:

'we could not refresh the credentials for the account. The browser based authentication dialog failed to complete. Reason: The protocol is not known and no pluggable protocols have been entered that match.'

Can someone please help me on this.

 

visual studio 2019 tutorial razor model app produces 404 error

$
0
0

I am using a VS 2019 Tutorial at

https://docs.microsoft.com/en-us/aspnet/core/tutorials/razor-pages/model?view=aspnetcore-3.1&tabs=visual-studio

There are slight differences in the tutorial and the actual results. The most glaring is that "RazorPagesMovie/Pages" is called Views but in the Scaffolding step the new pages are placed in a newly created Pages folder.

The Initial Migration step uses the Package Manager Console but in both  "Add-Migration InitialCreate" and "Update Database" the error "The specified deps.json [C:\Users\….\source\repos\RazorPagesMovie\RazorPagesMovie.deps.json] does not exist" occurs although the Build succeeded. Note that the expected"No type was specified..."  warning did NOT occur (although that error supposedly can be ignored.)

The next step is to run the app and append /Movies to the URL - This produces a 404 error

It would seem that the above views/Pages discrepancy has put the Movies folder in the wrong place

Deploy Visual C++ 2005 express edition in silent mode

$
0
0

I want to install visual c++ 2005 express Edition on window 10 in silent mode therefore i need to use unattend file and when itry to create it with this line in cmd:

[path]/setup.exe /createunattend [path]/vs2005.ini

i get this message: CreateUnattend and / UnattendFile are not supported for this product.

Any idea to solve it!

WinForm designer is broken in case using customer UserControl, and the platform target is x64

$
0
0

Here is very basic example.

When create a WinForm project and set the target platform to x64.

The designer will always give you error, when open the UserControlTest.

Any idea if it's by design or a VS bug?

the base class UserControlBase.cs

using System.Windows.Forms;

namespace WindowsFormsTest
{
    public class UserControlBase : UserControl
    {
    }
}

the Test class UserControlTest.cs

namespace WindowsFormsTest
{
    public partial class UserControlTest : UserControlBase
    {
        public UserControlTest()
        {
            InitializeComponent();
        }
    }
}


Evaluation Version of Visual Studio 2015?

$
0
0

Is it possible to download an evaluation version of 2015? 

Although I have an MSDN subscription, I'm creating a course on BizTalk 2016/2020.  There is no evaluation version for 2020, but there is one for 2016.  BizTalk 2016 requires Visual Studio 2015.  So in my view, a student could not evaluate BizTalk 2016 with also having an evaluation of Visual Studio 2015.  Students don't typically have money to buy a subscription, and i don't believe BizTalk 2016 won't work with the newer community versions. 

All my attempts to download it take me to a page that requires a Visual Studio subscription to download it.  Is there still an evaluation version of VS 2015? 

Thanks,
Neal 

Visual Studio MFC, multi-documents , get tooltip key down or ChildView::Ondraw

$
0
0

I create a MFC multi-documents.

I want to GetPathName or GetTitle() on ChildFrm

I used two method:

##########################

Method1.

I used a TabToolTip on MainFrm  , afx_msg LRESULT OnTabToolTip(WPARAM wp, LPARAM lp);

..

I press tab1, I can get GetPathName and GetTitle, but...

If i move mouse to tab2 , GetPathName and GetTitle is tab2.

If i move mouse to tab3 , GetPathName and GetTitle is tab3.

How to get tab1 PathName and GetTitle , don't influence by mouse move.

##########################

Method2. 

I use View::OnDraw(CDC* pDC) , virtual void OnDraw(CDC* pDC);

OnDraw don't work when i press GUI toolbar function.

##########################

I really appreciate if someone could advise me on this issue.


ExpandLineSelection not found anymore on shortcuts?

$
0
0

Hi everyone,

I am just starting learning Visual Studio and for that I downloaded the latest free version, Visual Studio Community. I see in a lot of videos that people fully select a line with a keyboard shortcut.

I don't want to copy the line, nor move it, nor delete the entire line, I just want to delete it's content.
I can eliminate a whole line with Ctrl+Shift+, but that forces me to press Enter after.

I have been reading an it seems that in previous versions you could select an entire line with Ctrl + I, which then changed to Ctrl + L. Right now, the last one is mapped to Edit.LineCut. 

I tried searching for ExpandLineSelection but it does not bring any results. It seems that in Visual Studio Code it is implemented but not in Visual Studio Community...

What would be the equivalent in Visual Studio Community?

Thanks in advance,
Shynn

Visual studio slows down my ability to edit my code

$
0
0

Hi everybody,

Certain VS functionalities, under certain execution conditions, are tedious. If I'm very happy to get instantaneous information on my code when I'm debugging, I don't have same need when I edit my code in edit mode. I use the community version of VS and I love MS people and their products, even if I'm a fervent Linux (Arch) user. I use VS in Win 10 on VirtualBox 6 on Arch. My VM have acces to 8g of ram and the 4 CPUs of the real machine. Despite of that, when I edit my code the tooltips of Intellisense (almost I think) disturb me and force me to click several times in the text before the insertion of the cursor could be done. Often, I do not realize it and I delete or write elsewhere than where I wanted to intervene.

So my question is here : Can I have automatic tooltips enabled only when I debug and not when I edit the code in edit mode ?

Thanks for reading.

Turn off auto-completion with space bar

$
0
0
I am using Visual Studio 2017 and auto-completion is a very useful feature. Except that in most editors it is triggered using either Enter or Tab key or both. In Visual Studio 2017 for some reasons it also works with space bar. This is extremely inconvenient because sometimes I type a variable name first and then add a type. This works fin in most editors, but in Visual Studio as soon as I press space bar, variable name turns into a type which may be a few dozen characters long and takes forever to delete. Is there a way to change auto-completion behavior so that it only triggers on Tab and/or Enter key?

How do I remove a customer project template?

$
0
0

I want to create some custom Visual Studio templates, for both VS 2017 and VS 2019. These are going to be project templates just for my coworkers and myself. They're not going into the Visual Studio Gallery. We've got a project that I want to make into a project template. 

Our practice to date has been to take this project that we use for generating a lot of new projects, by branching it in TFS (TFVC), then never merging this new branch back in. These has lead to two approaches. One of my colleagues just branches in main project in TFS, then starts editing the files to change them as needed. His approach is the fastest, but it results in a slew of projects all named the same when opening up VS to select a project to work on. Very often it confuses myself and other colleagues. My approach is to branch the project, but rename it appropriately. However, it takes me hours to get everything right, but within VS and TFS. It's error prone and tedious, having to visit each file separately to rename the namespace.

That's when, last year I learned about creating VS project templates. Great idea, I thought. So a year ago I exported the base project, which copied it into myDocuments\Visual Studio 2017\My Exported Templates folder. Then I had a lot of higher priority work thrown at me, so I lost momentum on this. Now that I'm working from home, and have a bit of a lull I thought I'd revisit this. Wouldn't you know if, but I re-exported the project using the same name as I did a year ago, because I had forgotten I'd started this a year ago. That resulted in 2 custom project templates in VS 2017, both named CoreFrameworkTemplate. I want to get rid of them both and start over again exporting the main project. I've deleting the CoreFrameworkTemplate.zip file from %userprofile%\Application Data\Microsoft\VisualStudio\12.0\ProjectTemplatesCache and %APPDATA%\Microsoft\VisualStudio\<version_and_optional_ID>\ProjectTemplatesCache and C:\Users\User\AppData\Roaming\Microsoft\VisualStudio\16.0_9daf0883\ProjectTemplatesCache as is recommended in this Stack Overflow post. But those folders don't always exist on my Windows 10 Enterprise machine and even when I did find them, then deleted the .zip file, it only got rid of one of the custom project templates.

So, how do I get rid of them all?


Rod

How to install Visual Studio Android Emulator in Windows 10 Home

$
0
0
Hi,
Iam using VS2015, Windows-10 Home. When I try to install Visual Studio Android Emulator in Windows 10 Home, It asked me to install Hyper-V. Then I installed. But now Iam getting the error message 
Visual Studio Android Emulator can not install in Windows 10 Home


Thanks

U.PARANTHAMAN

Visual Studio MFC , multi-documents add LineNumber

$
0
0

I create a multi-documents (MDI) project.

How to add line-number when i open a file or press New file?

I am not able to sign in visual studio

$
0
0

HI,

Some blank sign in page is apearinng when i am signning in the visual studio.

i am following the below steps to sign in.

1. I am connecting to out develpment searver where VS 2017 professional is there.

2.opening visual studio as diffirent user(the user credential with i have vs 2017 pro subscription).

3.click on sign in in the top right corner.

4.Blank sign in page is appearing with one moment please mesage.

Please assist me for this..

This is urgent issue.

Regards,

Sunil


Solutions and Projects Structure

$
0
0

I have a solution containing:

MySolution.sln

App1.API layer App1.DataAccess layer App1.Services layer App1.Models layer

Now under the same solution, I am creating a second app. What approach would be the best or any other direction:

a) MySolution.sln

App1.API layer App1.DataAccess layer App1.Services layer App1.Models layer App2.API layer App2.DataAccess layer App2.Services layer App2.Models layer

OR

b) MySolution.sln

App1.API layer App2.API layer App.DataAccess layer App.Services layer -folder app1 -folder app2 App.Models layer -folder app1 -folder app2

OR

c) MySolution.sln

App1.API layer App2.API layer App.DataAccess layer App.Services layer -all services together App.Models layer -all models together

OR

d) One solution for each app

Error D8016 : '/arch:AVX' and '/kernel' command-line options are incompatible

$
0
0

I'm trying to compile a library that contains AVX 512 instructions for linking with a kernel mode driver. For that I need both the following compiler flags:

 /arch:AVX512

 Enables the use of Intel Advanced Vector Extensions 512 instructions.

/kernel 

The code in the current project is compiled and linked by using a set of C++ language rules that are specific to code that will run in kernel mode.

However, the documentation for /kernel flag states that /arch:AVX is not supported. Is there any workaround to compile AVX 512 instructions for use in kernel mode?


How to get Version Info in Windows using VS2019 and not getting "Deprecated" error messages?

$
0
0

Hello,

I know this is a very mundane question and there are 100's of examples. I was cleaning up my old code and recompiled one of my working code using VS2019. During the build I got the deprecated warning. I do not want to ignore it nor suppress it. All the info out in Google talks about how to ignore it or suppress it. So please tell me what the XXXX stand for. There are 10 different things XXXX can stand for and I tried them in all combination and none of them worked :(. All I need is a clean build with no warning nor error. Thanks a lot. 

OSVERSIONINFOXXXX osvixxxx;

Zeromemory($osvixxxx, sizeof(OSVERSIONINFOXXXX);

GetVersionXXXX(&$osvixxxx);


Windows form buttons work without focus

$
0
0

Hi,

I've created a C# addon for Autodesk Revit which displays a modeless form that has various buttons on it to run certain commands.

This works well, but I've now discovered tool strips (I'm new to c# and windows forms). I've now removed the buttons from the form and used a toolstrip with buttons - this looks much cleaner.

But I've now noticed a strange effect. When had buttons on the form, I could click on them and they would work even though the focus would on Autodesk Revit and no my modeless form.

But now I have a tool strip, the buttons don't work unless the form has the focus, so in effect I need to click them twice - once to gain focus and again to operate them.

Is there any way I can change this operation and make the buttons on the toolstrip always work on first click?

Thanks.

Help with Microsoft Office Document Customization

$
0
0

Hi,

First of all, please know that I am not a MS Visual Studio user.  I am a user of Quickbooks Desktop Enterprise V. 20 and use the Intuit Report Writer.  We recently migrated from a hosting network to a managed cloud based filer server.  I have been creating Statement Writer reports and experiencing the follow message since we changed hosting environments. Does any one know how to solve the message below?

Microsoft Office Document Customization

The document might not function as expected because the following control is missing:  Sheet2.  Data that relies on this control will not be automatically displayed or updated, and other custom functionality will not be available.  Contact your administrator or the author of the document for further assistance.  

I have contacted Quicbooks support and they have not been able to resolve.  I posted a message on the QB community board, no luck there as well.  


Viewing all 21115 articles
Browse latest View live


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