Posts by Vítor Martins • 527 points
20 posts
-
3
votes1
answer86
viewsA: Copy and paste string without mask
Just assign MaskFormat.ExcludePromptAndLiterals to the property CutCopyMaskFormat. MaskedTextBox.CutCopyMaskFormat Get or set a value that determines whether literals and prompt characters are…
-
6
votes1
answer177
viewsQ: When to use Memorycache?
I would like a real example, not necessarily a code, on when use the MemoryCache on Web systems. What types of situation ask for its use? A little context: I participated in an interview where they…
-
3
votes2
answers682
viewsA: Doubt between using composite primary key or not in the associative table
That’s up to you. Both ways are right, but I find it really boring to work with composite primary keys, because to reference them by a foreign key, you need both columns. Imagine the chaos to add a…
-
1
votes3
answers648
viewsA: Removing items from a Combobox
How are you assigning a DataSource to the ComboBox, cannot handle your collection of items manually. In your case, just do as you imagined: cboStatus.DataSource = CartoesVTBLL.Status().Where(x =>…
-
1
votes1
answer33
viewsA: Library that performs Google searches
Android native does not have, but you can make communication with the REST API of Search, for example.…
androidanswered Vítor Martins 527 -
0
votes2
answers78
viewsA: C# error in dymamico click event
Your code is doing exactly what it should, although it’s not what you whether. Notice that at the event Click of the Tiles, you walk the IniFile whole and open each of the links. From what I…
-
2
votes3
answers58
viewsA: Nullreferenceexception error in Join
For what is void is the pd2, not the property pd2.codigoDetalhe. Try it like this: codigoDetalhe = pd2 == null ? "000" : "012",
-
0
votes2
answers426
viewsA: Httpclient how to make a request every 1 second
If you need to treat a queue, see the response from Rovann. If you want to wait for all Requests to complete and process all at once, it’s simpler the way below. I personally find timers quite…
c#answered Vítor Martins 527 -
4
votes4
answers2146
viewsA: SQL - Draw random lines
Try it like this: SELECT t.ordem, (SELECT TOP 1 rodada FROM tabela WHERE ordem = t.ordem ORDER BY NEWID()) FROM (SELECT DISTINCT ordem FROM tabela) t See in SQL Fiddle The call to the NEWID() within…
-
0
votes4
answers708
viewsA: Conversion of interface list into object list: (List<Interface> in List<Object>)
I found your example extremely strange and impractical, but you can do it using generic types. It is the only possible way if you want to maintain the polymorphism and references of your lists.…
-
0
votes1
answer160
viewsA: Build XML File Tip Using xml Serializer - More Efficient Way
Since you are using the XmlSerializer and wants to decrease the size of the generated files, my suggestion is to mark, in its classes, the properties of primitive types (double, string, int, etc.)…
-
1
votes1
answer640
viewsQ: Validate and capture sequence of numbers
I have this string: 16-8-10-20-30-65 The numbers are random and this is just one example. I need a regular expression that validates that sequence, captures all numbers before 65, including minus…
regexasked Vítor Martins 527 -
0
votes4
answers166
viewsA: C# WPF How to separate a long string into several positions of an Array?
I also found your doubt somewhat incomplete, but I believe you’re looking for something like this: public string[] DividirString(string str) { if(str.Length != 50*14) throw new…
-
0
votes1
answer114
viewsA: Organizing forms inheritance - C#
I did some research and discovered the MVP Pattern. I think it will be perfect for this project. In this case, it would be like this, I believe: If anyone wants to read about:…
-
2
votes1
answer114
viewsQ: Organizing forms inheritance - C#
I’m doing a program for selling products and I have a design problem. The differential of this program is that it can take on two different faces: one for the sale of chocolates and the other for…
-
0
votes1
answer42
viewsA: Populating Gridview with no selected record
I don’t know if I can prevent the Grid to make the selection, but to clear it is very easy: gdvAcesso.SelectedIndex = -1;
-
3
votes1
answer53
viewsA: Remove first <p> tag and last </p> string tag with jQuery
I think that solves! var s = "<p>uma coisa<p>outra coisa</p></p>"; s = s.substring(s.indexOf("<p>") + 3, s.lastIndexOf("</p>")); Now if the text does not always…
-
3
votes2
answers34
viewsA: If I return something within a using, will the resources be released?
Yeah, it’s a syntax-sugar with exactly the same operation as Try-Finally: var acd = new AlgumaClasseIDisposable(); try { return FazAlgumaCoisa(acd); } finally { acd.Dispose(); }…
c#answered Vítor Martins 527 -
6
votes3
answers2971
viewsA: Generate an xml in c#
You can do it with LINQ to XML, it’s very simple. I made a very basic example to make it easy to understand: public class Pessoa { public string Nome { get; set; } public int Idade { get; set; }…
c#answered Vítor Martins 527 -
0
votes4
answers340
viewsA: Is there a way to set width specified in html as the max-width of this element in css?
From what I understand, your server generates HTML dynamically and fills width. <div class="page-left-col"> <p> <img…