Posts by Matheus Miranda • 5,375 points
290 posts
-
2
votes2
answers51
viewsA: Set Dictionary to constant
I left another alternative using readonly private readonly static Dictionary<string, string> values = new Dictionary<string, string>() { { "tipo1", "dada65d" }, { "tipo2",…
c#answered Matheus Miranda 5,375 -
1
votes2
answers51
viewsQ: Set Dictionary to constant
Follow the code below: var values = new Dictionary<string, string> { { "tipo1", "dada65d" }, { "tipo2", "546541354765321" }, { "tipo3", "klwoiqyhalwtbfowh" } }; How can I declare the class…
c#asked Matheus Miranda 5,375 -
1
votes1
answer1257
viewsA: maskMoney(jquery) not displaying value correctly
Try to change the method .val() by method .maskMoney('mask', 0.01); Example: $("[id*=tbValorTotalEnsinoSuperior]").maskMoney({ prefix: 'R$ ', thousands: '.', decimal: ',' });…
-
0
votes1
answer810
viewsA: Edit text file on a specific line
Before following the code, you have to know which line you want to edit, in the example below put in line 1: int line_to_edit = 1; //linha 1 string newText =…
-
1
votes1
answer234
viewsA: How to turn a JSON into a table/paged list using . Net Core MVC?
Remembering that I copied here and played to txt file with Unicode encoding. The result of ReadAllText is the same as DownloadString. I tested only on the spot. Follows code: string json =…
-
1
votes2
answers1554
viewsA: Mask CURRENCY {en-BR} in Gridview C#
Following is code: (Version . NET Framework: 4.6.1) DataTable dt = new DataTable(); dt.Columns.Add("Valor formatado"); dt.Rows.Add(new object[] { string.Format(CultureInfo.GetCultureInfo("pt-BR"),…
-
7
votes1
answer120
viewsQ: Why can’t I see the icon code ( ) in developer mode?
Example of this icon: In developer mode (F12, Google Chorme), I can’t see the code of this icon, only image appears. Why does this happen ? Has some secret ? See the image below: Instead of…
-
1
votes4
answers1437
viewsA: Get user logged in to Asp.Net Core 2.0
You can either get value in class or control. The response of @Maycon F. Castro, is wrong, you can yes, get user name or identification using ClaimsPrincipal, See the example below: Class: public…
-
3
votes1
answer61
viewsA: How to disable Ctrl+V from the contextmenu?
The following code hides "Ctrl+ V": <TextBox> <TextBox.ContextMenu> <ContextMenu> <MenuItem Command="ApplicationCommands.Copy" /> <MenuItem…
-
2
votes1
answer61
viewsQ: How to disable Ctrl+V from the contextmenu?
In the textbox you can’t paste at all, the following code works right: private void Textbox_PreviewExecuted(object sender, ExecutedRoutedEventArgs e) { if (e.Command == ApplicationCommands.Paste) {…
-
0
votes1
answer24
viewsA: Text is selected when opening notification
Problem solved: $("#click_notifications").click(function () { if ($('li.nav-item.dropdown.dropdown-notifications').hasClass('open')) {…
-
0
votes1
answer24
viewsQ: Text is selected when opening notification
Follows code: $("#click_notifications").click(function () { if ($('li.nav-item.dropdown.dropdown-notifications').hasClass('open')) {…
-
0
votes1
answer568
viewsA: Bootstrap v4.1 - Notification displaying incorrectly
Failed to add: <link rel="stylesheet" href="stylesheets/bootstrap-dropmenu.css"> /*! * bootstrap-dropmenu v0.9.0 (https://skywalkapps.github.io/bootstrap-dropmenu) * Copyright 2015 Martin…
-
0
votes1
answer568
viewsQ: Bootstrap v4.1 - Notification displaying incorrectly
I use this plugin here: http://skywalkapps.github.io/bootstrap-notifications/2.0/ Segue Jsfiddle: https://jsfiddle.net/x7g1xoq1/2/ Follow the full CSS:…
-
0
votes1
answer530
viewsQ: Bootstrap v4.1 - Collapse does not work correctly
Follows code: $('#collapseDescricao').on('hidden.bs.collapse', function () { $('[data-target="#collapseDescricao"]').text("Mostrar descrição"); }); $('#collapseDescricao').on('shown.bs.collapse',…
-
0
votes0
answers35
viewsQ: Httppostedfilebase.ContentLength.Tostring() returns "0"
Follows code: HttpFileCollectionBase files; I get the file size like this: var tamanho = files[0].ContentLength; //tamanho é 1250 So far works normal when I want to convert to string: var tamanho =…
c#asked Matheus Miranda 5,375 -
0
votes2
answers997
viewsQ: How to insert new object in json file
Follows json file: [{"Id":0,"Nome":"","Endereco":""}] Follows the class: public class JsonResult { public int Id { get; set; } public string Nome { get; set; } public string Endereco { get; set; } }…
-
0
votes1
answer338
viewsQ: How to detect version of Windows OS?
I want to get a value of what system you’re using, like: Windows 7 or Windows 8 or Windows 8.1 or Windows 10 How can I do this in C# ? I’ve tried System.Environment.OSVersion doesn’t work right. I…
-
0
votes0
answers249
viewsQ: How to change a specific text from a txt file?
In my notepad has 2620 lines which is the maximum. >PRODUTO [1] 1. Exemplo de texto 1 2. Exemplo de texto 2 >PRODUTO [2] 1. Exemplo de texto 1 2. Exemplo de texto 22 >PRODUTO [3] 1. Exemplo…
-
1
votes1
answer2105
viewsQ: How to publish a site on Locaweb with an application made in ASP.NET MVC?
I have an application made in ASP.NET MVC, I want to publish in the company "Locaweb", see the following image: Follows error: An application error occurred on the server. The Current custom error…
asp.net-mvcasked Matheus Miranda 5,375 -
0
votes3
answers636
viewsQ: Object Reference not set to an instance of an Object. - Json
Follows code: public class Name { public string type { get; set; } } public class Items { public string type { get; set; } } public class Hobbies { public string type { get; set; } public Items…
-
0
votes1
answer563
viewsQ: Unable to read data from the transport Connection: Connection reset by peer
Follows the code: here. Customer code is receiving an exception: Unable to read data from the transport Connection: Connection reset by peer. Why this error? And how can I correct ?…
-
0
votes1
answer102
viewsQ: How to hide all buttons with foreach?
Follows code: FindViewById<Button>(Resource.Id.Button_1).Visibility = ViewStates.Gone; The code above is to hide a "button 1" and I have more than 50 buttons. I do not want to copy this whole…
-
0
votes1
answer30
viewsQ: Toolbar hiding a piece of textview
Follows code: <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"…
-
2
votes5
answers1602
viewsA: Change return /Date(1386295200000)/ to date format
The library Momentjs already supports ASP.NET JSON Date, see the documentation. Code example: moment("/Date(1386295200000)/").format("DD/MM/YYYY"); // 06/12/2013…
-
3
votes1
answer94
viewsQ: How to find out if TCP Listener is listening?
Library that I use: https://github.com/rdavisau/sockets-for-pcl Follows code: await client.ConnectAsync(address, port); The code above is the client and works normal. Let’s say the server is off,…
-
1
votes1
answer1120
viewsQ: How to put the 3 buttons at the bottom of the screen?
I want to put 2 buttons at the bottom and 1 button on the 2 buttons. Something like that: (but with the image upside down) These 2 buttons below and a button above 2 and all these 3 buttons should…
-
2
votes1
answer56
viewsQ: Bi-Directional Communication - How to get status?
Library that I use: https://github.com/rdavisau/sockets-for-pcl Follows code: Server: static async Task Run() { var listenPort = 11000; var listener = new TcpSocketListener();…
-
4
votes1
answer2182
viewsQ: The call thread cannot access this object because it belongs to a different thread
Follows the code: private async void button_1_Click(object sender, RoutedEventArgs e) { var listenPort = 11000; var listener = new TcpSocketListener(); listener.ConnectionReceived += async (senders,…
-
2
votes1
answer501
viewsQ: Bidirectional Communication - Send and Receive string value correctly
Follows code from server: int port = 11000/*PortGranter.GrantPort()*/; TcpSocketListener listener = new TcpSocketListener(); var tcs = new TaskCompletionSource<ITcpSocketClient>(); await…
-
2
votes1
answer2333
viewsA: How to capture a key pressed in C#
Follows code: if (e.KeyChar == (char)Keys.D0) { //tecla 0 pressionada btn0.PerformClick(); e.Handled = true; } For more information: here. Complete list of all key codes Keys Enum: here.…
-
1
votes2
answers158
viewsA: Get the name of the wifi connected in C#
I don’t know how to do it in pure C# but there’s a library ready for it, see here. I picked up through this reply: https://stackoverflow.com/a/431975/6647038 in English. Can install through: Console…
c#answered Matheus Miranda 5,375 -
0
votes2
answers158
viewsQ: Get the name of the wifi connected in C#
Obs: Não tem muita explicação, apenas obter o nome do wifi conectado.
c#asked Matheus Miranda 5,375 -
0
votes1
answer160
viewsQ: How to resize the font size - WPF?
The following code works with winforms: while (label1.Width < System.Windows.Forms.TextRenderer.MeasureText(label1.Text, new Font(label1.Font.FontFamily, label1.Font.Size,…
-
1
votes1
answer68
viewsQ: How to convert "Webclient" to "async/await"?
I have code that checks if you have the internet or not. public static bool InternetIsConnected() { try { using (var client = new WebClient()) { using…
c#asked Matheus Miranda 5,375 -
7
votes6
answers2555
viewsQ: How to change the title element text?
Follows code: $(document).ready(function() { $('#1ano_card_title').text('R$20,00'); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <h2…
-
1
votes2
answers2671
viewsQ: How to align a button always down?
I’m using bootstrap version 4.0.0 I took an example here: https://getbootstrap.com/docs/4.0/examples/pricing/ How can I make a button always aligned to bass ? You can see in jsfiddle that the "pro"…
-
-1
votes1
answer162
viewsQ: Kaspersky Anti-virus Blocking Modal Bootstrap
My blocking Antivirus when opening modal, the modal is not even displayed right. Follows code: Click event: $("#cartoes_click").click(function () {…
-
1
votes1
answer3078
viewsQ: How to make a regex that accepts 8 or 9 digits with 2-digit DDD?
I have Pattern code: ^[1-9]{2}9?[0-9]{8}$, then I changed my mind to do with regex with mask and such... Example: (11) 1111-1111 - fixo válido (11) 11111-1111 - celular inválido (11) 91111-1111 -…
regexasked Matheus Miranda 5,375 -
0
votes0
answers45
viewsQ: How to apply the form input validation classes of bootstrap v4 with the ASP.NET Razor syntax?
Follows code: View: <div class="form-group"> @Html.LabelFor(m => m.Telefone, new { @class = "font-weight-bold" }) @Html.TextBoxFor(m => m.Telefone, new { @class = "form-control",…
-
1
votes2
answers185
viewsQ: Losing the bar ("/")
Follows code: var token = "bHhETtde1UhKpwUVmTsNTpXZKyfZGK8/"; var token_string = Uri.EscapeDataString(token); //"bHhETtde1UhKpwUVmTsNTpXZKyfZGK8%2F" HttpResponseMessage response = await…
-
2
votes1
answer489
viewsQ: Conditional expression type cannot be determined because there is no implicit conversion between "<null>" and "Datetime"
Follows code: string data_string = "17/01/2018"; DateTime? data = data_string == string.Empty ? null : Convert.ToDateTime(data_string); I get error: CS0173 error Conditional expression type cannot…
c#asked Matheus Miranda 5,375 -
1
votes1
answer41
viewsQ: What is the difference between Settings and Resource?
Settings saves user preferences for the color scheme of an application for example and the Resource is for the same thing ? When should I wear Settings and when to use Resource in the Winforms…
c#asked Matheus Miranda 5,375 -
1
votes1
answer167
viewsQ: Bootstrap - Paint a whole row less a specific column
The code above almost works, just can not paint in the first column, how can I solve this ? $('table').on('click', 'tr', function () { if ($(this).hasClass('table-info')) {…
-
2
votes1
answer152
viewsQ: How to change Imagebrush background?
Follows code XAML: <TextBox /> <TextBox.Background> <ImageBrush x:Name="image_background" Stretch="Fill" TileMode="None" AlignmentX="Left" AlignmentY="Center" />…
-
2
votes2
answers301
viewsA: Keyup function in input when loading a modal
This event is triggered when the modal has been made visible to the user: $('#modalAlterarUsuario').on('shown.bs.modal', function (e) { // seu código js }); Following example in jsfiddle:…
-
1
votes1
answer99
viewsA: Predefined type 'System.Valuetuple 2 is not defined or Imported
The first error happens to those who use the lower version of . NET 4.6.2: Predefined type 'System.Valuetuple 2 is not defined or Imported You need to install the package or change the version . NET…
-
0
votes1
answer162
viewsA: How to use Drawtobitmap in WPF to take screen print?
Problem solved: Exchange that line @"C:\Users\Matheus Miranda\Desktop\TESTE" for @"C:\Users\Matheus Miranda\Desktop\TESTE"\nomedafoto.jpg I forgot to specify file name.…
-
0
votes1
answer162
viewsQ: How to use Drawtobitmap in WPF to take screen print?
Follows functional code of the WinForms: Bitmap pic = new Bitmap(label1.Width, label1.Height); Rectangle rect = new Rectangle(0, 0, label1.Width, label1.Height); rect = label1.ClientRectangle;…
-
2
votes1
answer39
viewsQ: Texblock - Make a text change event
I’ve seen the property of TextBlock does not have an event when changing text. Is there any way to do an event when the text is changed? * Remembering that it is for WPF and not Windows Forms. This…