[Solved] A picturebox import issue C#

From VS menu bar you can select Project -> Project properties(on the bottom) and then go to Resources tab. From here, you can add the resource(s) from disk, by hand. Then you can access them from code like this: PictureBox pb = new PictureBox(); pb.Image = Properties.Resources.NameOfResource; Don’t forget to set the rest of PictureBox … Read more

[Solved] I didn’t found the database in Entity Data Model C# Visual Studio

I don’t use SQL Express very often, but it looks like your connection string is not right. In your screenshot 1 it shows DESKTOP-VN2SRQQ\SQLEXPRESS as your SQL server\instance. In screenshot 2 you have chosen (localdb)\mssqllocaldb as the server\instance. Try changing the server to DESKTOP-VN2SRQQ\SQLEXPRESS 0 solved I didn’t found the database in Entity Data Model … Read more

[Solved] How can I substring word in C#

A simple approach is using string.Split() to split the words by white-space, take two words via Enumerable.Take and then join them with white-spaces again: string firstTwoWords = string.Join(” “, text.Split().Take(2)); Remember to add using System.Linq; Demo solved How can I substring word in C#

[Solved] Object not calling the value [closed]

See it yourself : void LoginScreen(){ //you still want to use addUser from main, so what is this ? UserInfo addUser[100]; ———–+ … | } | | void main() | { | | UserInfo addUser[100]; ————+ … } You can do something like this : void LoginScreen(UserInfo addUser[] ){ … } Obviously you need to … Read more

[Solved] decimal of numbers in c

The error is that %d in the format specifier of both scanf and printf represents decimal, so it expects an int (in the case of scanf, a pointer to int) Since you are declaring b and c as float, %d in the lines scanf(“%d”,&b); printf(“%d lbs is %d kgs.”,b,c); should be changed to %f respectively. … Read more

[Solved] array inside function

#include<stdio.h> #define MAX_SIZE_ALLOTED_TO_EACH_QUESTION 100 #define NUMBER_OF_QUESTIONS 10 int scoreList[NUMBER_OF_QUESTIONS]; // This array will contain the individual score for each answers to respective questions int i; void Extroversion(int scoreList[]){ // Let formula for this be E = 20 +(1)___-(3)___+(2)___-(4)___ int E = 20 + (scoreList[1] + scoreList[2]) – (scoreList[3] + scoreList[4]); printf(“\nExtroversion is the personality trait … Read more

[Solved] Cannot call start on a completed task [closed]

This code works for me and I can click the button multiple times without throwing the error in your title: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } void Button1Click(object … Read more

[Solved] Clarifications about pointers use

This seams to be bad quality code! Maybe not dangerous, as const appears in prototype. myFunc(const void * p) accepts a pointer to anything and const should mean it won’t touch it. Now, st is a pointer to myStruct, so st->arr is the value of arr member and &st->arr is memory address of arr member. … Read more

[Solved] Using new on same veriable without using delete- c++

The operator new[] allocates size bytes of storage, suitably aligned to represent any object of that size, and returns a pointer to the first byte of this block. realloc changes the size of the memory block pointed to by ptr. In your case, the first call on new[] operator creates a block, and then stores … Read more

[Solved] C++ Chocolate Puzzle [closed]

Here is how I would solve this in Java: import java.util.HashMap; import java.util.Map; import java.util.Random; public class ChocolatePuzzle { private static final Map <String, Integer> solutions = new HashMap <String, Integer> (); private static final Map <String, Integer> bestMoves = new HashMap <String, Integer> (); private static int [] x; private static int k (int … Read more