|
Open up the csproj file in a text editor and look for this line:
<Reference Include="System" /> If the line isn't there, include it alongside your other references.
This space for rent
|
|
|
|
|
Did you create a Console application by mistake? This is all setup for you already if you pick the Windows Forms Application project type.
|
|
|
|
|
Ok, created a new project for Windows form.
The recurring error now is:
Invalid token '(' in class, struct, or interface member declaration
In the code:
namespace Siren
{
static class Program
{
public partial class Form1 : Form
{
IDictionary<string, Assembly> _libs = new Dictionary<string, Assembly>();
int absW, absX, absY, absZ;
Console.Write("\nPlease input parameter 1 of first set... ");
absW = Console.ReadLine();
}
}
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
|
|
|
|
|
The Console doesn't exist in a Windows Forms app.
Also, this looks like you're putting Console code into a Windows Forms project now, where before you where trying to use Windows Forms code in something other than a Windows Forms project.
So, which is it supposed to be? What are you really doing?
|
|
|
|
|
I'm being impatient because I expected to be done with this today. But since that is not going to happen, I'll stop cobbling things together and recode with fresh eyes tomorrow.
Thanks for the help.
Will get back to you.
|
|
|
|
|
Dave Kreskowiak wrote: The Console doesn't exist in a Windows Forms app. Ehr.. stdout still exists in a WinForm. It is just a console-app that hides its console and puts up a GUI.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Yes, it does but the the purpose of this guys apparent homework, no it doesn't.
|
|
|
|
|
Homework is a strict assignment in order to learn a specific subject or topic.
This does not look like homework.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Whoops. My bad. I got this one confused with another thread.
|
|
|
|
|
Hi,
I am converting a model into Xml format. That gives me xml in string. This string consists several \" character instead of ".
I need to remove all \ character from string. I tried remove by using replace method but it's not going. Is it possible to remove this character?
|
|
|
|
|
Please edit your question and show the actual data and the code you are using.
|
|
|
|
|
Where are you seeing these characters? In the debugger?
If yes, do a Debug.WriteLine, and you'll see that those characters aren't really there
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
SqlCommand cmd = new SqlCommand("Select * FROM tbl_Loging where User Name=@user_name and Password=@password", con);
cmd.Parameters.AddWithValue("@user_name", text_User_Name.Text);
cmd.Parameters.AddWithValue("@password", text_Password.Text);
con.Open();
SqlDataAdapter adapt = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
adapt.Fill(ds);
con.Close();
Error : An expression of non-boolean type specified in a context where a condition is expected near 'Name"
P David
|
|
|
|
|
"User Name" is not a normal column-name, and the space in the name will muck up the command. If that is how the column is actually named, you should add brackets like below;
where [User Name]=@user_name
..and complain loudly about the person who designed the database
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Column names cannot contain spaces. Either rename your column to UserName , or wrap the column name in square brackets:
Select * FROM tbl_Loging where [User Name]=@user_name and Password=@password
However, you are currently storing your passwords in plain text. That is an extremely bad idea. You should only ever store a salted hash of the password, using a unique salt per record.
Secure Password Authentication Explained Simply[^]
Salted Password Hashing - Doing it Right[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
Message Closed
modified 6-Apr-17 12:31pm.
|
|
|
|
|
No, the column-name was the problem. The extra brackets are the solution to that problem.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi,
I have to get list of subdirectoris in parent folder ("A_ParentDir") which have names in format "vX.XX" where X is numeric.
Example : I have folder A_ParentDir which contains list of directories as below :
v3.20
v4.56
v8.1
v5.60a
v6.00v6.00
so I should have only :
v3.20
v4.56
I tried as below but I have also the last one in result
v3.20
v4.56
v6.00v6.00 // this shouldn't be
string strreg = @"v\d{1}\.{1}\d{2}$";
arrVersionsDirectories = Directory.GetDirectories(A_ParentDir)
.Where(path => Regex.IsMatch(path, strreg))
.ToList();
thank for help
|
|
|
|
|
You need to add a "start of string" indicator to your regex:
string strreg = @"^v\d{1}\.{1}\d{2}$";
But a simpler to read version would be:
string strreg = @"^v\d\.\d\d$";
If you are going to use Regexes, then I'd suggest you get a copy of Expresso[^] - it's free, and it examines and generates Regular expressions.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
|
Nope - see my other reply!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Ignore the previous answer!
I forgot the folder path was there...
Best way is to do this:
string strreg = @"^v\d\.\d\d{2}$";
arrVersionsDirectories = Directory.GetDirectories(A_ParentDir)
.Where(path => Regex.IsMatch(Path.GetFileName(path), strreg))
.ToList()
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Hi, I am coding two .cs files into one dll but Visual Studio 2012 sends the following error message:
The name 'Beeper' does not exist in the current context.
The first file codes like this:
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Windows.Forms;
namespace Hum
{
public class Singer
{
public void Beeper(long frequency, int msDuration, long volume)
{
}
}
}
When I do the function call in the second .cs file:
Singer cacophony = new Singer();
int Duration = 300000;
ThreadStart Wfrequency = new ThreadStart(Beeper(nw, Duration, 16383));
Thread childThreadW = new Thread(Wfrequency);
childThreadW.Start();
It gives the error.
I know I am missing something very basic.
Thanks for the help.
|
|
|
|
|
Beeper is a member function of Singer (the class)... Calling it like Beeper alone will only work when you are in the context of Singer (from other members for instance).
If you are out of that context you have to tell the compiler the new/actual context... in your case cacophony ...
So the code should be like this:
new ThreadStart(cacophony.Beeper(...));
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|