|
In addition to what Eddy Vluggen mentioned. I assume that "a" prefix has a purpose. Else it would not be necessary. Therefore other prefixes are possible too ("b", "c", "helloworld", ...).
you could save the prefix in another column, effectively allowing you to filter on it.
if the number in itself is unique I would use that as primary key, however if the numbers are only unique in the prefix itself, I would create a seperate sequence for the primary key and two columns "prefix" and "sequencenumber".
In addition, if you save in multiple columns this also allows more advanced sorting, grouping, counts, etc...
hope this helps.
best of luck.
|
|
|
|
|
Hi there,
I'm making a bible book app where I have listbox, richtextbox and search textbox.
I have som problem coding when the listbox text is chosen, It will show the listbox text + custom text in richtextbox.
I have done this:
private void btnAra_Click(object sender, EventArgs e)
{
int index = 0;
String temp = richTextBox1.Text;
richTextBox1.Text = "";
richTextBox1.Text = temp;
while (index < richTextBox1.Text.LastIndexOf(txtAra.Text))
{
richTextBox1.Find(txtAra.Text, index, richTextBox1.TextLength, RichTextBoxFinds.None);
richTextBox1.SelectionBackColor = Color.Orange;
index = richTextBox1.Text.IndexOf(txtAra.Text, index) + 1;
}
}
But since this is going to be a book app, I want the chosen listbox to show a text file in richtexbox and not only 2-3 sentences..
Any tip for what I can do?
Updated with this:
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
var str = listBox1.SelectedItem.ToString();
if (str == " Yaratılış Tevrat")
{
richTextBox1.Text = str + "\t\r\n\nText here";
}
else if (str == " Mısır'dan Çıkış (Yasa)")
{
richTextBox1.Text = str + "\t\r\n\ncustom text 2";
}
|
|
|
|
|
|
oPsType.FACId = TxtFACCrbf.Text;
oPsType.URC = TxtURCCrbf.Text;
oPsType.PPIDFrom = ddlfromppidcbrf.SelectedValue;
oPsType.PPIDTo = ddltoppidcbrf.SelectedValue;
foreach (ListItem item in lblMultiSelect.Items)
{
if (item.Selected)
oPsType.PAY_TYPE = oPsType.PAY_TYPE + item.Value.ToString();
<pre>
}
PSTYPE[] l = (from PSTYPE thenum in tmppsType
where thenum.URCName.Contains(oPsType.URC)
&& thenum.FACId.Contains(oPsType.FACId)
&& thenum.PAY_TYPE.Contains(oPsType.PAY_TYPE)
select thenum).ToArray();
PSTypeCollection x = new PSTypeCollection();
x.AddRange(l);
this.GridViewCRBF.DataSource = x;</pre>
|
|
|
|
|
Member 11504545 wrote: &&
Change that to a single amp. Take a look at some of these results[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
1) DownloadProgress event handler is only called once at the start of the download and never again afterwards.
2) DownloadFileCompleted is called right away, even though the file has not yet completed.
private async Task downloadFileAsync(FileEntity file)
{
try
{
using (WebClient client = new WebClient())
{
string outputFile = string.Format("{0}{1}", downloadPath, Path.GetFileName(file.FileName));
if (File.Exists(outputFile))
{
File.Delete(outputFile);
}
client.DownloadProgressChanged += DownloadProgress(file);
client.DownloadFileCompleted += DownloadFileCompleted(file);
await client.DownloadFileTaskAsync(new Uri(file.FileName), outputFile);
}
}
catch (Exception)
{
throw;
}
}
DownloadProgressChangedEventHandler DownloadProgress(FileEntity file)
{
Action<object, DownloadProgressChangedEventArgs> action = (sender, e) =>
{
double bytesIn = double.Parse(e.BytesReceived.ToString());
double totalBytes = double.Parse(e.TotalBytesToReceive.ToString());
double percentage = bytesIn / totalBytes * 100;
var _filename = file.FileName;
};
return new DownloadProgressChangedEventHandler(action);
}
public AsyncCompletedEventHandler DownloadFileCompleted(FileEntity file)
{
Action<object, AsyncCompletedEventArgs> action = (sender, e) =>
{
var _filename = file.FileName;
};
return new AsyncCompletedEventHandler(action);
}
I created these two event handlers because I'd like to know the name of the file in the events.
What am I doing wrong? Is there a better way to do these two?
Thanks
If it's not broken, fix it until it is
|
|
|
|
|
Again, I'm still very new to Async....
- WebClient.DownloadFileAsync returns void
- WebClient.DownloadFileTaskAsync is awaitable
They're both asynchronous. What's the difference? Why use one over the other?
Thanks
If it's not broken, fix it until it is
|
|
|
|
|
DownloadFileAsync was added in .NET 2.0, and uses the EAP model.
When async / await was added to .NET 4.5, many parts of the BCL were updated with new Task -returning TAP methods, which work better with the new syntax.
The guidance for TAP methods is to add Async to the end of the method name. However, since many EAP methods were already using this suffix, Microsoft decided to use the TaskAsync suffix - hence, DownloadFileTaskAsync .
DownloadFileTaskAsync[^] is the newer method, and is much easier to use with async / await .
Alternatively, you could use the even newer HttpClient[^] class, which was built with async / await in mind from the start.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks! Good answer
If it's not broken, fix it until it is
|
|
|
|
|
Psst try up voting the answer, it is generally appreciated and the correct way to reward a good question.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hello!
I am absolute new with c# and I wonder what {0} means in that code?
using System;
namespace DataTypeApplication
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Size of int: {0}", sizeof(int));
Console.ReadLine();
}
}
}
Many thanks!!!
|
|
|
|
|
First argument. See Composite Formatting[^] for details.
In this instance, it will always be the string 4 because sizeof(int) is 4 by definition (in C#).
|
|
|
|
|
|
how can i convert hex value present in textbox into rgb and store it into new textbox?
|
|
|
|
|
If you mean your average 6-character hexadecimal RGB value .. it's already RGB.
So exactly what do you want to convert to what?
|
|
|
|
|
That depends on exactly what you want to show!
A "hex number" is technically an RGB code already, but that isn't too useful.
So start by converting it to a Color:
public Color FromHex(string hex)
{
if (!hex.StartsWith("#")) hex = "#" + hex;
return ColorTranslator.FromHtml(hex);
}
Now you can use the colour to set the Text color of the new textbox:
displayTextBox.ForeColor = FromHex(hexTextBox.Text);
Or show what colour it is:
displayTextBox.Text = FromHex(hexTextBox.Text).ToString();
Or it's RGB values:
Color c = FromHex(hexTextBox.Text);
displayTextBox.Text = string.Format("{0}:{1}:{2}", c.R, c.G, c.B);
[edit]"ForColor" changed to "ForeColor" - Thanks Richard![/edit]
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
modified 8-Apr-15 14:17pm.
|
|
|
|
|
OriginalGriff wrote: ForColor
I didn't realise you'd been affected by the great Welsh "E" drought. Here, have a few of mine to use:
Eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee!
I think you meant "ForeColor".
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
No, I'm trying to convert my monitor to CMYK and missed out the "U"...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
how can we share files in .net on a single pc while files are stored in same database?
|
|
|
|
|
Share with who? And what files woul you store in a database?
|
|
|
|
|
Elaborate more, this insufficient information to get exact problem.
modified 20-Sep-20 21:01pm.
|
|
|
|
|
i have been workinng with how to make androide xml analser. i cant come up with the answer.
|
|
|
|
|
what do you want to specifically?
Life's like a nose, you've got to get out of it whats in it!
|
|
|
|
|
You need to make a specification of what you want this analyser to do. Once you have the specification you will then be able to break it down into smaller jobs and it wont seem so hard.
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
Hey,
first, if i writing on bad category, im sorry, i didnt found the help category..
Okey, to my problem. I have a RGB STRIP connected to Arduino, when im communicating via Serial. All works great! So next i wanted to make some audio visualisation.. So i found some samples etc.. and then i created the Audio Visualisation via C# using BASS.NET, when R has been BASSes, G medium frequency and B high frequency. But isnt looking good, so i started thinking, what 3 variables in song has can use, but this is bad idea.. I got idea to change to random color when its get "beat" or BASS hit some value. I tryied 4 hours of doing it, searching, programming... But i cant do it... Im only 15 and non english so im limited in searching etc...
So, my question is how to detecting the beat or just anything event for Audio Visualisation. Best output form WASAPI. Im out of ideas and anything.. Only what i can do is get FFT and Audio Spectrum from WASAPI by BASS.NET, but thats all. My audio skills is so low for this. Anything is welcome!
Thanks.
|
|
|
|