|
HOW I CAN GET C# WINDOW FORM THEME?
PLEASE HELP ME THIS QUESTION.
THANK YOU.
|
|
|
|
|
DON'T SHOUT. Using all capitals is considered shouting on the internet, and rude (using all lower case is considered childish). Use proper capitalization if you want to be taken seriously.
And then explain what you mean: we have no idea what you understand by "WINDOW FORM THEME" so we can;t help you until you explain.
Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I have an ICollectionView bound to a DataGrid which contains 1 million items and should be filtered as user types in a search text box. Due to the large number of items, filtering algorithm should be performance friendly.
This is my current string comparison (some part of filtering method):
static bool AreEqual(string str1, string str2)
{
var compareInfo = CultureInfo.InvariantCulture.CompareInfo;
bool result = compareInfo.IndexOf(str1, str2, CompareOptions.IgnoreNonSpace) > -1;
return result;
}
The CompareOptions.IgnoreNonSpace ignore diacritics very well but ignores half space with Unicode \u200c too, which is not what I want. I just want to ignore diacritics.
bool compare1 = AreEqual("آبی","آبی");
bool compare2 = AreEqual("آبی", "ابی");
bool compare3 = AreEqual("آبی", "آبی");
bool compare4 = AreEqual("آبی", "ابی");
Since, the performance is critical, I can't remove diacritics with normalizing strings before comparison.
One more question:
I want to filter CollectionView, in a way that, first 10 results will be returned and continue to search in a background thread while user is reading current DataGrid viewport. When user scrolls the DataGrid, show next 10 results which are filtered in the background thread. I don't want user waits for CollectionView to finish filtering 1 million items.
|
|
|
|
|
You can start a search background worker that adds results to a concurrent queue.
The UI threads pulls results from the queue and displays them. Keep the results and reuse them when doing incremental searching.
If you're buffering x results at a time, stripping diacritics, etc. is not a performance issue.
A "million" something doesn't say much. If it fits in memory, loading it in the first place is the main issue, and can be done while the app is starting up.
Then consider replacing all your int enums with byte or flag enums in the data, etc.
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
|
|
|
|
|
My database is a text file contains 1 million string line, like this:
word1,word2,word3,word4
word1,word5,word7,word4,word6
word3,word4
word5,word6,word7
Loading the file into a CollectionView doesn't take many time (About 1 second). The main issue is Filtering collection view, because datagrid uses a little complex data template. Can you give me a sample code to showing just 10 result at a time?
This is my code
|
|
|
|
|
private int paged = 0;
...
var items = myList.Skip( paged ).Take( 10 );
paged += items.count;
...
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
|
|
|
|
|
Hi,
I want to make a query to an xml database.
I use a textbox to ask the query but i cant get it work
Here is the code that i have
XDocument doc = XDocument.Load(@"C:\Work\stores.xml");
var xpath = "//store/Color[text()]" + textBox2.Text;
var result = ((IEnumerable)doc.XPathEvaluate(xpath)).Cast<XElement>().FirstOrDefault();
textBox1.Text = result.Value;
xml:
<pre><stores>
<store rollNumer="170">
<Name>Jonh</Name>
<Color>Pink</Color>
<Sell>Sugar</Sell>
</store>
<store rollNumer="120">
<Name>Tedy</Name>
<Color>Brown</Color>
<Sell>Rice</Sell>
</store>
</stores>
Thank you
|
|
|
|
|
devilonline1 wrote: i cant get it work
Means nothing to us: we can't run your code under the same conditions you do (if nothing else my file structure will not contain the same paths as yours) so we need much better information.
"It doesn't work" is probably the most useless problem report we get - and we get it a lot. It tells us nothing about what is happening, or when it happens.
So tell us what it is doing that you didn't expect, or not doing that you did.
Tell us what you did to get it to happen.
Tell us any error messages.
Tell us what you tried to work out what is happening.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
well I have this code:
XDocument doc = XDocument.Load(@"C:\Work\stores.xml");
var xpath = "//store/Color[text()=]" + X;
var result = ((IEnumerable)doc.XPathEvaluate(xpath)).Cast<XElement>().FirstOrDefault();
textBox1.Text = result.Value;
and it worked fine
when I want to pass a variable it gives the error: " System.Xml.XPath.XPathException: the expression must be aviliated.." in this line "var result = ((IEnumerable)doc.XPathEvaluate(xpath)).Cast<xelement>().FirstOrDefault();"
|
|
|
|
|
devilonline1 wrote: the expression must be aviliated
That's not the correct error message. Did you mean:
"Expression must evaluate to a node-set"
That still means that your XPath query is invalid.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
I'm not sure if this will help you, but I know how you feel regarding querying XML... It has plagued me for about a week now. I just came up with this code yesterday, it searches, copies and saves XML:
private static object GetSetting(string source, string setting)
{
XmlDocument xdoc = new XmlDocument();
xdoc.Load(source);
return xdoc.SelectSingleNode("/Settings/" + setting).InnerText;
}
private static void AdjustSetting(string source, string setting, string value)
{
XmlDocument xdoc = new XmlDocument();
xdoc.Load(source);
xdoc.SelectSingleNode("/Settings/" + setting).InnerText = value);
xdoc.Save(source);
}
And here is the XML:
="1.0"="utf-8"
<Settings>
<Exit>true</Exit>
</Settings>
finally, here is the code I'm using this on:
AdjustSetting(Xmlpath, "Exit", "false");
while (GetSetting(XmlPath, "Exit").ToString() != "true")
{
ProcessInput(Console.ReadLine());
}
If you need me to explain any of this please feel free to ask. I hope it helps..
|
|
|
|
|
i am getting below error
System.Web.Services.Protocols.SoapException: Format of the initialization string does not conform to specification starting at index 97.
below is my connection string
<property name="connection.connection_string">"Provider=SSISOLEDB.3;Data Source=***;User ID=***;DB=**;PWD=**;"
i am using nhibernet
|
|
|
|
|
See my linq query first
var query = (from r1 in dtMappedSectionNotEmpty.AsEnumerable()
join r2 in dtData.AsEnumerable()
on r1.Field<string>("Row").Trim().ToUpper() equals r2.Field<string>("RowCoordinate").Trim().ToUpper()
join r3 in _Periods.AsEnumerable()
on r2.Field<string>("StandardDate").Replace("A", string.Empty).Replace("E", string.Empty).Trim().ToUpper() equals r3.Replace("A", string.Empty).Replace("E", string.Empty).Trim().ToUpper()
where r1.Field<string>("Tab").Trim().ToUpper() == strTab.Trim().ToUpper()
select new BrokerData
{
RowNumber = r1.Field<string>("Row") ?? "0",
TabName = r1.Field<string>("Matched Section") ?? "",
StandardDate = r3.ToString(),
BRTab = r1.Field<string>("Tab") ?? "",
BRLineItem = r1.Field<string>("Broker Items") ?? "",
Action = r1.Field<string>("Action") ?? "",
StandardLineItem = r1.Field<string>("Matched Items") ?? "",
StandardValue =r2.Field<string>("LineItemDateValue") ?? ""
}).ToList();
in my above code there are 2 datatable and one list. now i am not being able to compose left and inner join in same query.
there will be left join between dtMappedSectionNotEmpty and dtData datatable. means left join between r1 & r2
again there will be inner join between dtData & _Periods means i want inner join between r2 & r3
so please see my code and give me another set same LINQ code where left join and inner join will be there in same query. thanks
|
|
|
|
|
Use "intermediate" queries. LINQ will do the same internally. There is nothing special or heroic in doing it in the "same query".
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
|
|
|
|
|
i know i can break the query into two separate to achieve this job but i need to know if i want to do left & inner join in same query then how could i compose it. i stuck for syntax. if you know then post a sample LINQ query where left & inner join will be performed in same query. thanks
|
|
|
|
|
we are developers and our winform project is in VSTS. our product is in-house product means our product users are also from our company employees. we use click once publish option to give update to our users. when we publish our product changes by client once deployment then it is publish to global folder from where all user get their update.
i have no idea how CI/CD works and also i do not know does it fit for our winform project?
nowadays many company uses CI/CD. does it only applicable for web application or CI/CD can be used for winform project too ?
please guide me how could i use CI/CD for our winform project to distribute update to our in-house client ?
please tell me by azure CI/CD how can i push publish to my winform project from VSTS to folder of my pc ?
i will be glad if anyone give answer. thanks
|
|
|
|
|
This forum is for specific questions regarding C# code. There is not space to answer your questions, which are too broad for a technical forum. See CI/CD - Google Search[^], which is where you should find the answers.
|
|
|
|
|
Por favor me ajude a resolver este problema amigos, ja tentei e não consigo.
using System;
using System.Globalization;
namespace _1002
{
class Program
{
static void Main(string[] args)
{
double R = Convert.ToDouble(Console.ReadLine());
double A = Math.PI * Math.Pow(R, R);
Console.WriteLine("A = " +A.ToString("F4",CultureInfo.InvariantCulture));
}
}
}
|
|
|
|
|
You can't "solve" an input string format problem: it says what it means: the user typed a value that cannot be interpreted as a valid double
You can prevent your app from crashing though:
double R;
while (true)
{
Console.Write("Please enter the radius of the circle :");
string input = Console.ReadLine();
if (double.TryParse(input, out R))
{
break;
}
Console.WriteLine($"\"{input}\" is not a valid number.");
}
double A = Math.PI * Math.Pow(R, R);
Console.WriteLine("A = ", A.ToString("F4",CultureInfo.InvariantCulture));
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
OriginalGriff wrote: You can't "solve" an input string format problem: it says what it means: the user typed a value that cannot be interpreted as a valid double This could be a culture issue. In many languages, the decimal point is a decimal comma; the point is used as the thousands separator.
The simple form of TryParse (or Convert.ToDouble) use the "Digit grouping symbol" and "Decimal symbol" specified in the regional settings. I am not familiar with Spanish conventions (and maybe in varies among Spanish speaking countries): If the local convention is to uses comma as a decimal symbol, but the regional settings have not been set properly to reflect this entering e.g. 1.234.567,89 will cause a format error.
Alternately, if regional settings are set to the local culture, but the user is accustomed to having to follow English conventions when working with computers, and enters 1,234,567.89, it will fail as well.
ToDouble and TryParse have overloads allowing the specification of a format, so that you can override the regional setting. If you want to accept either, you must scan the string: If both comma and point appears in the string, whichever appears first is likely to be the digit grouping symbol, not a decimal symbol. If only one of them appears, but multiple times, it is likely to be a digit grouping symbol.
If only one of them apppears, once, the format is ambiguous. You might guess that if the number of digits following the symbol is anything but 3, it is a decimal symbol. Or the context may indicate which is the most probable interpretation - usually, one value is more likely than thousand times larger or smaller. Or, if you in the same application activation have had other numbers input, containing both comma and point, you may assume that the same numeric format is used, in ambiguous cases.
Once you have determined the proper comma/point interpretation, you can call the TryParse function with the proper format indicator.
|
|
|
|
|
I made from a database get and created in HDD. But how to read by axAcroPDF1.src (Adobe Reader)
|
|
|
|
|
If it is on-disc, than you can simply launch the document as if it is an executable; the application associated with its extension would be used to open it.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
i'm new to C# and i'm just doin a test proj... i wonder why this happened?
using System;
namespace test_cs
{
class Program
{
static double calc(double n, double m)
{
return (n * m);
}
static void Main(string[] args)
{
Console.WriteLine("Welcome to calculator 1.0");
Console.Write("Enter calculations:");
double num1, num2;
char oper;
num1 = Convert.ToInt32(Console.Read());
oper = Convert.ToChar(Console.Read());
num2 = Convert.ToInt32(Console.Read());
Console.WriteLine("{0} {1} {2}", num1, oper, num2);
Console.ReadLine();
Console.ReadLine();
}
}
}
the result is:
Imgur: The magic of the Internet[^]
anybody can explain why?
also, i actually wanna make input streaming like C++
std::cin >> num1 >> oper >> num2;
but haven't know how to do it in C#
modified 14-Feb-20 12:25pm.
|
|
|
|
|
Simple: COnsole.Read fetches a single character from eth input types by the user, and you are converting that to an integer - but Convert changes type, not value. The character '3' is not the same a a number 3 - it's a character with a particular value within a character set, which is actually 51 in decimal: http://www.asciitable.com/
What I'd suggest is you read it as a line:
string input = Console.ReadLine(); And then "break" that into separate token strings:
Match m = Regex.Match(input, @"^(\d+)([^\d])(\d+)$");
if (m.Success)
{
int a = int.Parse(m.Groups[1].Value);
string op = m.Groups[2].Value;
int b = int.Parse(m.Groups[3].Value);
Console.WriteLine($"{a} {op} {b}");
}
This also means that it will work if you enter 123+456
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|