|
As part of a solution we have a project that started from the Class Library template. It does not have any screens but does have some custom controls and other things that required the UseWPF and UseWindowsForms switches be turned on. There is really no template set up for this.
So many years of programming I have forgotten more languages than I know.
|
|
|
|
|
Weird, but OK. I know I know nothing of your project, but I probably would have split that up into two separate libraries, one for each type of project, but I understand there are reasons I don't know about.
There is no list of configuration "switches" (UseWPF or UseWinForms) used in csproj files that I can find anywhere.
The last-ditch effort to find those would probably be to create a new project of each template type and go look in their csproj files for what's being used.
|
|
|
|
|
i need instruction for creating simple game in .Net Core C#
|
|
|
|
|
You're not going to get any with such an incredibly vague "question".
You didn't specify anything at all about the kind of game you want to build, the rules, interaction, ..., NOTHING AT ALL.
...and you expect an answer?
The only one you're going to get is Google for ".NET Core C# game tutorials".
|
|
|
|
|
"I'm thinking of a number between 0 and 9 ..."
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
1. Learn C#
2. Learn .NET Core
3. Create a design
4. Develop the code from the design.
|
|
|
|
|
I am a great fan of Imagelistview but one thing still evades me and that is the vertical scroll value and programmatically changing it rather than using the system vertical scrollbar due to cosmetics. You can use the EnsureVisible command to bring any item into the controls view but it lacks the feel of smoothness and control. If you let the control display the normal system scrollbars then you can use them to scroll through the imagelistview smoothly. What I want to be able to do is change the VerticalScroll value without using the mouse but I cannot find any command syntax that allows you to change it or read its current value.
Any help welcome, I have asked on the devs forum but remains unaswered.
|
|
|
|
|
|
Dear All
I am sanding string to my instrument through tcpip socket protocol. String received at instrument correctly. I received string back from instrument also. but when i convert string in to hex value i get multiple Zero after my ETX (03)hex value.. can some one help me. code for your ref. is
Dim PORT As Int32 = Txtport.Text
Dim client As New TcpClient(Txtip.Text, PORT)
Dim stream As NetworkStream = client.GetStream()
' Translate the passed message into ASCII and store it as a Byte array.
Dim data As [Byte]() = System.Text.Encoding.ASCII.GetBytes(sndstr)
stream.Write(data, 0, data.Length)
' Txtrt.Text = sndstr
' data rec.
Timer1.Enabled = True
Dim Bytes As Integer = -1
Dim Buffer(1024) As Byte
Dim Message As String = ""
Dim ClientStream As System.Net.Sockets.NetworkStream = client.GetStream
Do While Bytes <> 0
Bytes = ClientStream.Read(Buffer, 0, Buffer.Length)
Message = System.Text.Encoding.ASCII.GetString(Buffer)
If Message.IndexOf("QE") <> -1 Then
' Found the end of the message...
Exit Do
End If
Loop
' Message = Message.Trim(Message.Trim(Chr(0)))
Txtrt.Text = Message
Dim ba() As Byte
Dim hexval As System.Text.StringBuilder = New System.Text.StringBuilder
ba = System.Text.ASCIIEncoding.ASCII.GetBytes(Message)
For i As Integer = 0 To ba.Length - 1
hexval.Append(ba(i).ToString("x2") & " ")
Next
RECEIVEDDATA.Text = (hexval.ToString())
I Rec. data 02 61 61 10 31 03 00 00 00 00 00 00 00 00 till the size of buffer
my end of msg. is 03 how to remove all 00 after value 03
modified 1-Feb-21 23:50pm.
|
|
|
|
|
Hi
Currently in my local machine, after i develop my net core Web API, i built an image and run my Web API in docker container
Then i open a Web browser and default to http://localhost:4200/api
I having a question
Let say i want to deploy my Web API image to other production machine and run as container as well, and i want to redefine my Web API Access URL, example
http://my-sample-web.com/api/
How can i do that's?
Is it to set it in my apps settings or in my docker file?
Hi, I would feel glad to be a membership of CodeProject, I know the site could help developer much
|
|
|
|
|
Hello, I have a request for help with how to format a text box with numbers with 3 digits with two decimal places. but will not advance until a decimal point is placed, this works with one box. but i would like to implement this on 14 text boxes in a group box. so i don't have to duplicate the code 14 times.
Private Sub RollTemp_BOTTextBox_KeyPress(sender As Object, e As KeyPressEventArgs) Handles RollTemp_BOTTextBox.KeyPress
Dim keyChar = e.KeyChar
If Char.IsControl(keyChar) Then
'Allow all control characters.
ElseIf Char.IsDigit(keyChar) OrElse keyChar = "."c Then
Dim text = Me.RollTemp_BOTTextBox.Text
Dim selectionStart = Me.RollTemp_BOTTextBox.SelectionStart
Dim selectionLength = Me.RollTemp_BOTTextBox.SelectionLength
text = text.Substring(0, selectionStart) & keyChar & text.Substring(selectionStart + selectionLength)
If Integer.TryParse(text, New Integer) AndAlso text.Length > 3 Then
'Reject an integer that is longer than 16 digits.
e.Handled = True
ElseIf Double.TryParse(text, New Double) AndAlso text.IndexOf("."c) < text.Length - 4 Then
'Reject a real number with two many decimal places.
e.Handled = True
End If
Else
'Reject all other characters.
e.Handled = True
End If
End Sub
The Text Box will have like 123.67 in it. But if you enter 123 it doesn't let you put another number in and advance until you put the (.) in and then allows you to put another number in.
Thank you
|
|
|
|
|
You can always reuse the same event handler for the different textboxes. What I would do is rename this event handler so it doesn't refer to the control by name and then point each of the relevant controls KeyPress events at this event handler. As the sender refers to the textbox that raises the event, you can refactor the method to avoid using Me.RollTemp_BOTTextBox by casting sender to a TextBox type.
|
|
|
|
|
Would you give an example please, i am not following your explanation. Would be grateful.
|
|
|
|
|
Start by creating a collection / list that contains your "14 text boxes".
How you create your list "depends" on what you're doing now. That's enough of a task for the time being.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
As Pete suggested:
Private Sub NumericTextBox_KeyPress(sender As Object, e As KeyPressEventArgs) Handles RollTemp_BOTTextBox.KeyPress, OtherTextBox.KeyPress, YetAnotherTextBox.KeyPress
Dim keyChar = e.KeyChar
If Char.IsControl(keyChar) Then
ElseIf Char.IsDigit(keyChar) OrElse keyChar = "."c Then
Dim box As TextBox = DirectCast(sender, TextBox)
Dim text As String = box.Text
Dim selectionStart As Integer = box.SelectionStart
Dim selectionLength As Integer = box.SelectionLength
text = text.Substring(0, selectionStart) & keyChar & text.Substring(selectionStart + selectionLength)
Dim valueInt32 As Integer
Dim valueDouble As Double
If Integer.TryParse(text, valueInt32) AndAlso valueInt32 > 999 Then
e.Handled = True
ElseIf Double.TryParse(text, valueDouble) AndAlso text.IndexOf("."c) < text.Length - 4 Then
e.Handled = True
End If
Else
e.Handled = True
End If
End Sub How to: Connect Multiple Events to a Single Event Handler - Windows Forms .NET Framework | Microsoft Docs[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank you Pete, i see now what you mean. So easy when you have the expertise.
|
|
|
|
|
this could also be your Solution - integrate the functionality into your own customized Textbox :
Public Class NumericTextbox
Inherits TextBox
Private Sub NumericTextBox_KeyPress(sender As Object, e As KeyPressEventArgs) Handles Me.KeyPress
Dim keyChar = e.KeyChar
If Char.IsControl(keyChar) Then
ElseIf Char.IsDigit(keyChar) OrElse keyChar = "."c Then
Dim box As TextBox = DirectCast(sender, TextBox)
Dim text As String = box.Text
Dim selectionStart As Integer = box.SelectionStart
Dim selectionLength As Integer = box.SelectionLength
text = text.Substring(0, selectionStart) & keyChar & text.Substring(selectionStart + selectionLength)
Dim valueInt32 As Integer
Dim valueDouble As Double
If Integer.TryParse(text, valueInt32) AndAlso valueInt32 > 999 Then
e.Handled = True
ElseIf Double.TryParse(text, valueDouble) AndAlso text.IndexOf("."c) < text.Length - 4 Then
e.Handled = True
End If
Else
e.Handled = True
End If
End Sub
End Class
|
|
|
|
|
Hey @all
I wish a very good new year 2021 to you
I am from Germany and new in here and I have already read many interesting articles.
I have a problem and whether google knows sth about that than me. I try to explain it to you now.
I am designing a testing environment which i am appealing to via CAN-Bus and a 2 Channel CAN Interface.
It all runs on C# with VS2019.
I use one form to communicate to my test environment CAN Channel.
Another form is used for CAN on my tested device.
in the third form I designed my GUI. So far it is working very well.
I builded the .exe and copied it to another directory.
Now I try to start this exe with another form, called launcher, because i design many GUIs which are built to .exe files.
Some of my GUIs start from the launcher, but some do not. One form of the CAN Interface is showing up, but is then closing.
When I click on the exe in this directory directly, everything is working fine!
But I only got it with 2 GUIs. The other 10 GUIs are working well in this.
The Launcher is written on .netcore3.1.
Also the GUIs are.
I tried also with .net4.7.2, cause I am also using Measurement Studio of NI.
I do not know any reason for that issue. I can not explain that to me :/
Does anybody have had an issue like that?
If you need further Informations, please ask me for that.
I am very desperasted on that.
Thank you in advance.
With best regards,
Daniel
|
|
|
|
|
Member 14955332 wrote: Some of my GUIs start from the launcher, but some do not. One form of the CAN Interface is showing up, but is then closing.
When I click on the exe in this directory directly, everything is working fine!
How do you launch your exes? Are you using the exe's full pathname?
|
|
|
|
|
Hi, sorry for my late reply.
i wanted to use relative paths. Now I tried with absolute patz directly on C://
it is the same problem.
The exe is started but then the problem appeared. So Pathname is OK
How I call the exe:
private void btStart_Click(object sender, EventArgs e)
{
string opentest = "C:\\TesterV4\\Data\\Tests\\" + lbHersteller.SelectedItem.ToString() + "\\" + lbTests.SelectedItem.ToString() + "\\netcoreapp3.1\\Basis.exe";
try
{
Process p = new Process();
p.StartInfo.FileName = opentest;
p.Start();
p.WaitForExit();
}
catch
{
MessageBox.Show("Datei konnte nicht gefunden werden", "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
|
|
|
|
|
Maybe there is a similar problem (pathname) in the exe you are starting?
|
|
|
|
|
The only way you are going to resolve this is to add some logging/debugging code to the started program. It is impossible for anyone here to guess what it is doing.
|
|
|
|
|
Hello all
I'm new here and wanted to ask about .Net and Vue.js.
I have to do a project at school that is not so simple in my opinion.
I should develop a web application that should work with .NET and Vue.js.
I have to generate a PDF document with the user's input and send it to a mail. I also have to identify the mail address from the user's input and send it to him.
Can you help me how I can approach the whole thing. I am grateful for any help.
Thanks a lot
|
|
|
|
|
Of course you can get help - you only need to ask a specific question ...
So ... where do you stuck ?
But one thing you should realize first : this is not a "do the whole work for me"-Forum ...
|
|
|
|
|
Dir all. I am a new here. I just start a Web NETcore 5.0 MVC and the connectionstring has been set in the
appsettings.json like this:
"ConnectionStrings": {
"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=ManagementSystem;Trusted_Connection=True;MultipleActiveResultSets=true"
}
I know that the database will be create in the "
C:\Users\Nguyen Tuan Anh "
You can see the projet is here: GitHub - nguyentuananh921/HomeJob[^]
I want to setup the database so it is created in Project Folder as a relative not fix so that when I upload to github and then I can come to other pc and clone it without losing data.
Thanks.
|
|
|
|