Posts by Leo Longhi • 1,209 points
37 posts
-
0
votes1
answer87
viewsA: enable full transparency of the png background in the form
You can cancel the event where the Background is painted and fill in an image this way: public SeuForm() { InitializeComponent(); FormBorderStyle = FormBorderStyle.None; StartPosition =…
-
2
votes2
answers64
viewsQ: Inherit comments from a virtual object
How can I inherit the comments within the tag <summary> of an object? I have the following class: class BASE { /// <summary> /// String de Conexão a base de dados. /// </summary>…
-
0
votes1
answer26
viewsA: Problem in mysql query
Utilize NOT IN to search for values that are not listed in the parameters NOT IN (valor1, Valor2...Valores) And fill out this list with your Booking table details ("where NOT IN Booking ID"). It…
-
1
votes1
answer368
viewsA: Load two fields from a Datagrid using a txt file
One solution is to use a Datatable for the service. Add to your project one Datatable with two columns, 'Product' and 'Price' public DataTable produtos = new DataTable() { Columns = { new DataColumn…
-
0
votes1
answer237
viewsQ: Calling variable object from a string
I’m trying to call an object from a string, which contains its namespace, class and object name, however, all of these are variables and do not have a fixed object type I found a similar question,…
c#asked Leo Longhi 1,209 -
2
votes1
answer542
viewsA: Date field 7 days after the current date in c#
Just compare if the day is Saturday or Sunday until seven days are added up DateTime d1 = Convert.ToDateTime(txt_dataemissão.Text); int dias = 0; while (dias < 7) { d1 = d1.AddDays(1); if…
c#answered Leo Longhi 1,209 -
0
votes1
answer325
viewsA: Insert date written to the textbox in a certain format for the database
Convert your text to a format datetime in this way cmd.Parameters.AddWithValue("@StartDate", DateTime.ParseExact(txtStartDate.Text, "yyyy-MM-dd HH:mm:ss", null);); To set a Datetimepicker for a…
-
2
votes1
answer2285
viewsA: How can I check if all textboxes are empty?
If you want to check all textBoxes the best way and create a dynamic method(imagine a registration screen where you have a large amount of textBoxes) private bool textBoxVazias() { foreach (Control…
-
1
votes1
answer92
viewsA: When clicking the button check whether the value of the textbox contains in a table column
The problem in the code is found in your Count int j = ds.Tables[0].Rows.Count; if (j == 0) { MessageBox.Show("word" + txtNome.Text + "already exists!"); ds.Clear(); } This means that the message…
-
2
votes2
answers3189
viewsA: See if there is a file in a folder c#
To check if the file exists, or work (copy, read, create and etc) with files, use the class File: File.Exists("Destino do arquivo") So just get in if the same doesn’t exist with a denial operator…
c#answered Leo Longhi 1,209 -
3
votes2
answers45
viewsA: A separate city sql query
Simple, just use the Where to the desired city and order by to sort by date if you want to select data from only one city. Select * from SuaTabela where colunaCidade = "Brasilia" order by colunaData…
-
4
votes2
answers211
viewsA: What value is verified in a condition operation with value assignment to a variable?
The Code will test the value of the return variable, which in the case received the return value of the method bool retorno = default(bool); if ((retorno =…
-
3
votes2
answers1294
viewsA: show selected value in listview c#
If at any time you need to take the selected value from listview use the following code: listView.SelectedItems[0].ToString(); If you need every time the selected item changes the value to be…
c#answered Leo Longhi 1,209 -
7
votes3
answers13782
viewsA: Changing the data type of an sql column
First of all, have a Backup, this is the guarantee that nothing will be lost. To change the type or size: ALTER TABLE Clientes ALTER COLUMN CliTelCel char(11) Data will not be lost as you just…
-
6
votes1
answer517
viewsA: How to modify a window in Windows Forms?
On the properties of your form, you can choose the Borderstyle among some available options provided by the VS, and this will change the items you quoted. All these styles will be based on your…
-
2
votes1
answer146
viewsQ: Garbage Ollector is automatic?
I noticed that my application was deliberately consuming the memory even after the end of the processing, even finishing everything that was started so I called the GC.Collect(); and the memory was…
-
3
votes3
answers2752
viewsA: Comparison of Strings in sqlServer
If this is a column of one of your tables, you can use the Max() within your select to take the most value, this way: Select Max(sua_coluna) from sua_tabela If the comparison is made between two…
-
3
votes3
answers669
viewsA: Field with Cedilla in Mysql
Enter the name of your field between ` to indicate that it is a field (this is also for restricted and/or spaced names) INSERT INTO caixa_geral_dc ( `descrição`, empresa, valor_c_d, conta,…
-
5
votes1
answer301
viewsA: How to make an element disappear after used?
You can use the methods Hide() and Show() of its elements to hide and display respectively. button1.Hide(); //Esconde o Botão button1.Show(); //Exibe o Botão This can also be used for other graphic…
-
14
votes8
answers2223
viewsA: Error: not all code paths Return a value
Your code needs to return a value to All cases, in your Get class this does not happen, when the code enters the condition IF he has a Return, but in case you don’t get in(Else) it returns nothing,…
-
1
votes1
answer300
viewsA: Generate file . Ret Boleto
If you want to understand a little more about the files . RET of a glance here. Basically, the return files from the banks 'Are not generated', they are returns! The responsible for providing this…
phpanswered Leo Longhi 1,209 -
0
votes1
answer40
viewsQ: Query where result equals any of the values in the list
I have a table of Duplicates that has the month reference as string,(ex: 01/2012, 05/2016 and etc) And I need to perform a query between a date range, if the field was Datetime I know it would be…
-
1
votes1
answer83
viewsQ: Processing cost between code and database
Among the many forms of development, there was a doubt about what will consume the most of my processing between the same operation in different ways... If I have a function that can be done…
-
0
votes1
answer2125
viewsA: How to pass a Textbox value to Datagridview
After Reply I noticed that the question was edited in the meantime and the tag C# Removed leaving only VB.net, I took the liberty of convert the codes I wrote in C# for Vb thus leaving the 2…
vb.netanswered Leo Longhi 1,209 -
3
votes2
answers140
viewsA: Directories in c#
Use the Method Directory.Getfiles with the option to search in all directories var Arquivos= Directory.GetFiles(@"C:\Users\anacarvalho ", "*.sql", SearchOption.AllDirectories);…
c#answered Leo Longhi 1,209 -
2
votes1
answer65
viewsA: How to make a select that brings the data registered in a given week?
Have in your *Sqlcommand * Two parameters, one for the start date and one for the end date,(put in the example as A and B respectively), The string of the command was also incorrect, the dates you…
-
2
votes1
answer2764
viewsA: Helps with over processing
Usually this occurs when there are long processing and the Debugger thinks it is a Deadlock but it’s not necessarily!(it’s just a warning) This only happens in debug mode, to disable this warning…
c#answered Leo Longhi 1,209 -
2
votes2
answers700
viewsA: Dropdownlist quantity Items
Using position:Absolute; and this.size, it is possible to choose the amount of items(10 in the example) <asp:DropDownList ID="cbfuncionario" onclick="this.size=1;" onMouseOver="this.size=10;"…
-
1
votes1
answer664
viewsA: Push notifications
I use in my system the component Balloon devcomponents to set the display location i Seto the following balloon configuration b.DesktopLocation = new Point(SystemInformation.WorkingArea.Width -…
-
2
votes1
answer265
viewsQ: Exit Standard Event on ESC key
Currently in my system I use the event KeyPress to identify the key Esc and so close my form, but I have a very large system with more than 50 forms and even more being developed: My question is: Is…
-
0
votes2
answers441
viewsA: How to disable double-click the header of a Datagrid?
Remove Handler from the event EventHandler eventHandler = new EventHandler(dataGridView_CellContentDoubleClick); dataGridView.CellContentDoubleClick -= eventHandler;…
-
0
votes1
answer213
viewsA: Keeping variable values in a class
From what I understand you want to keep the data fixed? (Ñ have to pass the information every time you make the calls) If this is your case, the solution is quite simple! Declare your Serial Port as…
c#answered Leo Longhi 1,209 -
1
votes1
answer49
viewsA: Insert with Postgresql datatime and c#
When you pass the date between " "it goes as a string and not a date itself, the second case worked because a date was passed as parameter! convert your string to date and everything will occur as…
-
2
votes3
answers1224
viewsA: C# - Close Form without Stopping Application
Tip: Because instead of calling the login form first, it doesn’t start with the second one, so it can call the login and get login permission to continue! can change the first form to be called in…
-
2
votes2
answers113
viewsA: XML for Datatable
it is possible yes, everything depends on the creation of XML, I use an api in the company who and returns data in the following way <xs:element name="LedgerID" type="xs:int" minOccurs="0" />…
-
1
votes1
answer306
viewsA: Get list of items from a listbox
Very simple, the listBoxalready control itself contains the list(listbox.Items)... if you still want to transfer them to a list specify just create the list and assign the listbox items to it. var…
-
2
votes2
answers275
viewsA: How to know which button called the page?
it is possible to use the sender to perform the identification by converting the object to a button and using the . property. Button BotaoClicado = sender as Button; string Nome = BotaoClicado.Name;…