|
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.
|
|
|
|
|
You might want to search for the term BPM (Beats Per Minute). (if not done so already)
Hope this helps.
|
|
|
|
|
Yes, i found something with BPM, but i cant integrate that for the BASS.NET, and i didnt found any example for using it in WASAPI. Is possible to provide some example to BPMCounter for WASAPI in bass.net?
Thanks
|
|
|
|
|
I have a form with a few textboxes and checkboxes. I want to store in database values from them. But, I also have a button that selects an image from computer and show link of the image in a textbox. Well, I want to insert data but without inserting an image and here comes my problem, I receive: Empty path name is not legal . Can anybody help me? Thanks
Code is here:
try
{
byte[] imageBt = null;
FileStream fstream = new FileStream(this.textBox5.Text, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fstream);
imageBt = br.ReadBytes((int)fstream.Length);
SQLiteCommand com = new SQLiteCommand("insert into questions(question,answer1,answer2,answer3,option1,option2,option3,category,qcategory,indexrow,indexyes,indexno,cherowstart,cheyes,cheno,currentrow,image) values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + result1 + "','" + result2 + "','" + result3 + "','" + comboBox1.SelectedItem + "','" + comboBox2.SelectedItem + "',0,0,0,0,0,0,0,@IMG)", Conexiune.getConnection());
com.Parameters.Add(new SQLiteParameter("@IMG", imageBt));
com.ExecuteNonQuery();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
Code for image selection:
try
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = "JPG Files(.jpg)|.jpg|PNG Files(.png)|.png|All Files(.)|.";
if (dlg.ShowDialog() == DialogResult.OK)
{
string picLoc = dlg.FileName.ToString();
textBox5.Text = picLoc;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
|
|
|
|
|
I don;t see you loading anything in the picturebox, but I do see a SQLite database being opened. Is the connection opened correctly?
You would start by showing not "ex.Message", but "ex.ToString()", as that will also include a hint as to "which" code went wrong.
You should also read up on SQL-injection, as that is one of the worst ways to build a SQL-statement. It is hard to read, hard to maintain, and it is a security issue.
When done, check out what a using-clause is. That way your connection and command would be disposed when done.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Start by assuming TextBox5 contains no text, and your error should appear - so the most likely thing is that your user pressed Cancel instead of selecting an image, or that code was never called. So check - if it's empty, don't continue.
But...there are other problems here, from the trivial:
Why do you think you have call ToString on a string? What do you expect that to do?
string picLoc = dlg.FileName.ToString();
To the very serious: Do not concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database. Use Parametrized queries instead.
You are clearly aware of the existence of parameterized queries and how to use them, but you leave your code wide open to anyone with a keyboard and your application anyway? Why? Do you not like your data?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Sincer am luat acel cod de pe youtube. So, I'm sorry if is wrong, but I need to upload a photo in table with sqlite..I will try do to what you said, what can I say. And about conection, I have a class where I have the connection and a function that returns connection, this way is better than to open it and close it on every time you need it. Thank you
|
|
|
|
|
I'm sorry, but could you try that again but in English this time?
That makes no sense to me at all!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Sorry, I wrote that very quickly and I was thinking at something else in the mean time )))) It's ok, I solved it
|
|
|
|
|
Dear All,
Kindly let me know the code and and steps for create SMS sending program by using C#.net via my GSM dongle that connected to Laptop. I'm new to this field and as a student still studying so I'm expecting your favorable response..
Thank you.
|
|
|
|
|
|
|