Posts by CypherPotato • 9,292 points
289 posts
-
6
votes3
answers519
viewsQ: How does C# run on other platforms?
As a complement to this question, run C# on a system where . NET Framework is native, it is default to run the application executable. As far as I know, C# depends on the . NET Framework to be…
-
2
votes3
answers106
viewsQ: How to create unmanaged variables?
When a variable is created, a value in memory is allocated to it, which can be accessed by any system on the outside from the address of that memory. Creating a file to store the contents of a…
-
12
votes1
answer449
viewsQ: What’s this 'in' in C#?
In the new version of C#, version 7.3 the parameter changer was introduced in, but I didn’t understand its functionality. By name, it seems that it is used as "input" for the values, contrary to the…
-
1
votes1
answer52
viewsA: How to make the console output appear in a textarea in Windowsforms?
A console only displays the executable log, it would be complicated to redirect the output of the Console stream to a Textbox (this is not impossible, but boring). There’s a simple line of code that…
-
0
votes4
answers741
viewsA: how to calculate the amount of days with date input?
Try to catch the difference between the two dates. Being a the initial date and b the final date: // créditos //…
-
0
votes3
answers251
viewsA: How to separate in pairs the digits of a variable in C#?
This method supports any type of element, provided it is enumerable. In principle, declare the following method: /// <summary> /// Splits an array into several smaller arrays. ///…
c#answered CypherPotato 9,292 -
1
votes1
answer517
viewsA: Visual Studio Form Covering Windows Taskbar or Getting Behind Taskbar
Try to set the maximum size for the window to be the safe area of work area. You will need to include the two references: using System.Drawing; using System.Windows.Forms; And put these procedures…
-
2
votes2
answers110
viewsA: Block using and Exceptions
Hold on, let me explain. using is for when you will use an object and then discard it without storing information in memory. using (StringBuilder sb = new StringBuilder()) { sb.AppendLine("Olá,…
-
0
votes3
answers265
viewsA: Effect of unwanted scroll
I just removed the instruction that threw the page up and it looks like it worked. Try to do this. <!--Import materialize.css--> <link type="text/css" rel="stylesheet"…
-
0
votes1
answer50
viewsA: VB net how to send picture q is in a user control for a form
It’s not hard: Public Sub PictureBox1_Click(ByVal sender As Object, e As EventArgs) Handles PictureBox1.Click ' Desabilita verificação cross-thread Control.CheckForIllegalCrossThreadCalls = False '…
-
1
votes1
answer31
viewsA: VB-NET How to give a new location to a control? , with a variable value
It’s simple: you’re passing a String (string) as an argument to build a new Point, and the correct construction is (int, int). Take the example: Dim VarPbx As String = "PictureBox" & "2" Dim pbx…
vb.netanswered CypherPotato 9,292 -
0
votes1
answer551
viewsA: How to use a variable that represents the name of a label to change its value?
Try to take control by his name: Dim referencia As Label = DirectCast(Me.Controls("Index_3"), Label) referencia.Text = 3 If it doesn’t work, use Control.Find Dim referencia As Label =…
-
0
votes1
answer168
viewsA: Calling an . exe application in a C#Panel
Natively it is not possible, but you can call internal methods from user32.dll to make this possible. Call the method SetPointerParent with the target executable and the control that will be…
c#answered CypherPotato 9,292 -
0
votes0
answers51
viewsQ: Is it possible to run a Windows executable stored in memory?
I have an executable that is not an . NET Framework Assembly stored in a byte[], and I intend to run it without creating a file dedicated to it for security reasons. The reason you don’t want to…
-
0
votes2
answers888
viewsA: How to get the row and column indexes of a list List<List<int>>?
Try this: static int GetIndex(List<List<int>> array, int line, int column) { // índice atual int temp_index = 0; // percorre nas linhas até onde você quer ir for(int x = 0; x <= line;…
-
2
votes1
answer4081
viewsA: Root and power in C#
case "RAIZ": resultado.Text = Math.Sqrt(value).ToString(); // num break; case "POTENCIALIZAÇÃO": resultado.Text = Math.Pow(value, Double.Parse(resultado.Text)).ToString(); // num, expoente break; To…
-
0
votes2
answers114
viewsQ: Why is there the term "Private" in . NET?
Declaring variables without specifying the variable access level in C# and Visual Basic . NET ends up making the private, only the type/location where it was created can access and/or modify it.…
-
8
votes1
answer521
viewsQ: What are the differences in ". NET"?
I took a look at this reply, but did not answer my question. As far as I know, there is .NET Framework, . NET Core, ASP.NET, . NET Standart and Mono but I don’t know the difference between them and…
-
1
votes1
answer48
viewsQ: Can I run a . NET Native image directly?
I built my executable in C# for an image. NET Native using ngen.exe, I have the file location, but when I run Windows says the executable is invalid. My goal was to make my application written in C#…
-
2
votes1
answer56
viewsQ: Can MSIL be converted to Native code?
I can convert a . NET Framework generated from a C# executable to a code Native code? If yes, from this Native code, I can transcode to other languages like C++? If not, there is a lower level of…
.netasked CypherPotato 9,292 -
0
votes3
answers2225
viewsA: File . bat does not run
The syntax of FOR for a single-line command is only directed to when you will use the Console directly, for a BATCH file no directive is required /F. @echo off FOR %%i IN (C:\estacoes.txt) DO…
-
1
votes1
answer209
viewsA: Vb . net Custom Controls
It is not easy. There are several possibilities, among them: Using a UserControl // the easiest way It’s quite simple to create a set of controls, like maybe a little list with a few preset buttons…
-
5
votes2
answers139
viewsQ: Can hashes be different for the same bytes?
I’ve found a flaw or I can’t deal with hashes. I have two bytes arrays random, one generated by an algorithm and one original. I am trying to make the algorithm EXACTLY the same as the original.…
-
1
votes1
answer248
viewsA: How to move a window using a button? c#
There is a technique available in this project of Codeproject, she’s kind of like this: public const int WM_NCLBUTTONDOWN = 0xA1; public const int HT_CAPTION = 0x2;…
-
12
votes2
answers1470
viewsQ: What are the pointers?
I’ve come across this in several languages, mainly C and C++, but I’ve never understood what it is, how it’s used, and why it exists. I found out unintentionally that it also exists in C# and it’s a…
-
1
votes2
answers402
viewsA: Sending information between PC (Windows Form, C#) and Android
If you want to do something broad, with access to several computers and few requirements, I recommend using Wi-Fi. So you can work using network sockets and no third party API is required to…
-
0
votes1
answer109
viewsA: How to access the main thread from the main thread
The Main thread will need invocation, during debugging will show an error when you operate a Cross-Thread operation, but this exception will be non-existent at the time of Release. If your Thread is…
-
1
votes1
answer66
viewsQ: Why doesn’t this redacted code work the same as the original?
I’ve been studying C++ for a while and I want to train by rewriting functions already done by me in C# only in C++. I wrote a simple code that computes a IV of a Hash, very simple even, calling the…
-
0
votes1
answer123
viewsA: Opacity adjustment of the panel background in Vb.net
You can adjust opacity properties [alpha] in the color of the panel: Dim Opacity As Int32 = 50 ' valor em porcentagem Me.Color = Color.White Panel1.Color = Color.FromArgb(50, Color.Black)…
vb.netanswered CypherPotato 9,292 -
1
votes1
answer2046
viewsA: Decrypt MD5
MD5 is a hashing algorithm, and not cryptography. It is expressly impossible to reverse the Hash action. The Hash is used within an encryption system, more precisely used to encrypt passwords,…
-
3
votes1
answer119
viewsQ: How to upload safely?
How to do upload/download of a file on an FTP server without this server’s login information being visible in the code? For example, I nay I want to do the following: string FTPhost =…
-
1
votes1
answer542
viewsA: Changing content of one form without opening another in c#
Manipulating UserControl(s) you can create an inherited object from Control. So, create your form in this UserControl and make it work as a Form. After that, create a Panel client who will display…
c#answered CypherPotato 9,292 -
1
votes2
answers414
viewsA: VB.NET - Find text in XML file
First it is necessary to know the following to answer your question: If you have already done the XML file interpreter and, How you’re handling each element. Assuming you are using a dynamic class,…
-
1
votes1
answer128
viewsA: Flood Visual Basic
It’s very confusing your question, but I understand that you either separate lines and execute commands on these separate lines, well, come on. Let’s create a method that executes actions in a…
vb.netanswered CypherPotato 9,292 -
0
votes4
answers1255
viewsA: Converting Httppostedfilebase to byte[] : Exception_wasthrown
public static byte[] Bytes(HttpPostedFileBase result) { byte[] data; using (Stream inputStream = result.InputStream) { using (MemoryStream ms = new MemoryStream()) { inputStream.CopyTo(ms); data =…
-
2
votes1
answer213
viewsQ: How to repeat number at a maximum?
I have two whole: n and m: n: Number that will repeat in the index; m: Index maximum. What I need to do is simple, is to return a number that is <= m on the basis of n. When n is larger, it will…
-
7
votes3
answers1105
viewsA: App being recognized as potentially dangerous
There are several factors for Windows to consider an executable like dangerous: Clickonce and its permissions Executables signed with Clickonce make administrator permissions easier to be managed by…
c#answered CypherPotato 9,292 -
5
votes1
answer557
viewsQ: Is it recommended to manipulate rules with "Try-catch"?
We can manipulate errors in various ways, but the one that will use less code and time of the programmer is the try, present in almost all object-oriented languages. But, when should be used try,…
-
2
votes1
answer506
viewsQ: When to use And, Andalso and Or, Orelse?
I don’t know when to use the syntax Or or OrElse and/or And or AndAlso, because I don’t understand what difference it makes in the logic circuit. Being in C#, And = &, AndAlso = && and…
-
2
votes1
answer4088
viewsA: How does the DES algorithm work?
What is the des? The DES (Data Encryptation Standart) (or in English, information encryption standard) is a method of obtaining an asymmetric key for a virtual information, but today is already…
-
1
votes1
answer47
viewsQ: How do users' Sids work?
I need to implement an authentication system written in C#. NET based on users of Windows, so it will be authenticated according to some identification only of users. The problem is that the only…
-
0
votes2
answers1339
viewsA: Check the internet connection
You can use requests Ping using Ajax to another server and test if there is a connection with it, you can use your same server, or use another server: // Importa o JQuery <script…
javascriptanswered CypherPotato 9,292 -
0
votes2
answers252
viewsA: Return 2 values in a foreach
Return two literal values in a single variable is impossible, but you can return one List<string> with two values and so use them in your block For Each, enumerating the return of Funcao():…
-
2
votes1
answer398
viewsA: How to run programs without specific path
If you are trying to run an application whose location is not determined, try searching for it recursively using a root directory. Thus, the method GetFiles will enumerate all executable files…
-
2
votes1
answer195
viewsQ: Is it possible to store files in an executable?
I need to store a file, no matter its extension (it’s mainly an Executable) within another executable. It’s just, I’m compiling with Codedom an executable that inside it there is a file "special"…
-
1
votes3
answers335
viewsA: Add data from a sql column c#
The structure TimeSpan supports addition through method Add, you can do this by resorting to the entire loop. From what I understand in your code, cont is the hour worked in a column row, well, add…
-
1
votes1
answer1136
viewsA: How to generate 5 digit number automatically?
Implement a "cache" of random numbers, so the created numbers are cached, and you check whether it exists or not: using System.Collections.Generic; ... static List<int> random_caches = new…
c#answered CypherPotato 9,292 -
0
votes1
answer154
viewsA: Is it possible in VB.net’s Geckofx to use `Getelementbyid`?
Other than WebBrowser, is another procedure to get the ID of an element in HTML. Consider this small code your page and its element: <div id="lst-ib">conteúdo</div> In the Gecko API, you…
vb.netanswered CypherPotato 9,292 -
0
votes1
answer47
viewsA: Is it possible to do assignment with shorter object initializer?
You have not finished declaring the variable before the ;, because the assignment of operators/literal values will not be valid. You can make a "Gambiarra" that organizes the code if you are using…
c#answered CypherPotato 9,292 -
1
votes1
answer39
viewsA: How to get the right DPI?
Try to circumvent with Winapi. First, you will have to add these references: using System.Drawing; using System.Windows.Forms; It is possible to obtain the DPI of all monitors installed with calls…
c#answered CypherPotato 9,292