|
Hmm. I don't have much choice of what tags i get to use in the first instance.
I file could come in with any version of an ID3 tag so im gonna have to check 'em all out i guess.
I've also got to accomodate for the tags in WMA files, which are much clearly labled it seems. For example, a tag might contain this: O r i g i n a l A r t i s t Bob
Incase you couldn't tell, the original artist is Bob
|
|
|
|
|
I am trying to get and R, G, and B value and make the form that color, but the BackColor. R, G, and B values are all read-only. how should i go about doing this? is there a way to convert RGB values into hex-colors(or whatever they're called - 000000 is black and ffffff is white)and then assign the hex to the form?
thanks in advance
|
|
|
|
|
The R, G and B properties are read-only because you can't change a color value, you have to create a new color value.
You can use the FromArgb and ToArgb methods to convert from int to Color and back.
You can use the formatting string "X6" if you want to format an int to a six digit hexadecimal string, and if you want to parse a string to an int.
---
It's amazing to see how much work some people will go through just to avoid a little bit of work.
|
|
|
|
|
hi
i have a button in my webPage and i define a Javascript Function in my Suorce Page and set OnClientClick="MyJavaScrpitFunction()", it is worked good but my problem is when i click button at runtime, page is Reload and refresh my page and my cpntrol's Changes will be lost. i want only OnClientClick event run and don't want button_click event run.
how to solve problem ?(i thinks that override button_click event but how to ?)
and does have SomeBody Suggestion for this operation ?
thanks
|
|
|
|
|
Did you try removing the event declaration?
|
|
|
|
|
i don't create event handler. it will run automatically
|
|
|
|
|
Are you trying to prevent the page being posted back when you click the button and just want to run some javascript on the client when it is clicked?
If so, maybe setting the button's on client click to the following will work:
"MyJavaScrpitFunction(); return false;"
|
|
|
|
|
Hi Plz I need help on this
I have a schedular that on specific time fires a function
this function fires another function that takes arguments from a database
well here is my problem: at runtime it seems that the function does not recognise the arguments
PLZ Can any one help me on this
|
|
|
|
|
I have a main form, and a form named preferences, and i have attempted to get the information from the form into the settings, where i have the background color information stored.
Preferences.cs:
private void btnPickBGColor_Click(object sender, EventArgs e)
{
colorDialog1.ShowDialog();
BackgroundPanel.BackColor = colorDialog1.Color;
txtBackGroundColorName.Text = colorDialog1.Color.Name;
}
private void btnSave_Click(object sender, EventArgs e)
{
Close();
}
Form1.cs (starting form):
private void btnPreferences_Click(object sender, EventArgs e)
{
Preferences PreferenceDialogBox = new Preferences();
PreferenceDialogBox.BackgroundPanel.BackColor = Properties.Settings.Default.BackGroundColor;
PreferenceDialogBox.txtBackGroundColorName.Text = Properties.Settings.Default.BackGroundColor.Name;
if (PreferenceDialogBox.ShowDialog() != DialogResult.Cancel)
{
Properties.Settings.Default.BackGroundColor = PreferenceDialogBox.BackgroundPanel.BackColor;
Properties.Settings.Default.Save();
this.BackColor = Properties.Settings.Default.BackGroundColor;
}
}
how else should i get the information into settings? the preferences form does detect the background color settings and adjusts the display and text accordingly.
Thanks for the help
(and sorry about the long code)
|
|
|
|
|
there isn't a problem in the code, but i found out that the save button was set as a cancel button.
|
|
|
|
|
Hi all,
I have a drop down control which let the user to select for creating number of textbox controls into the form. Once it generate the textboxes, I check the view source for each of the textbox control with _ctl0, _ctl1 ..... added in front of the textboxes'id. I need to get those value and insert into the DB. Here is my code behind.
private void btnMulitTextBox_Click(object sender, System.EventArgs e)
{
SqlConnection conn = ....;
conn.Open();
cmd = new SqlCommand("....", conn);
cmd.CommandType = CommandType.StoredProcedure;
int i = 0;
int totalnumofctrl = Convert.ToInt32(this.ddlNumtoGenerate.SelectedValue.ToString());
while (i < totalnumofctrl)
{
DoInsertToDB(i);
i++;
}
}
private void DoInsertToDB(int ctrlnum)
{
string textboxname ="_ctl" + ctrlnum + ":txtAName";
System.Web.UI.WebControls.TextBox tb = this.FindControl(textboxname) as System.Web.UI.WebControls.TextBox;
cmd.Parameters.Add("@AName", tb.Text);
cmd.ExecuteNonQuery();
}
I got "Object reference not set to an instance of an object." error everytime I run this. Any idea? Thanks in advance.
gsdg
|
|
|
|
|
One would suspect that your "FindControl" method is failing to return a match, causing a null reference error in the next line of code. It might be helpful if you included the code for that (as well as the code that creates the textboxes so that we could see how they get named). In any case, you should check tb for null before using it.
Also, it appears that cmd is instantiated in the first method, and used many times in the second method, without clearing the parameters list before adding a new one by the same name.
|
|
|
|
|
Stop spamming. You already have an active thread about this.
---
It's amazing to see how much work some people will go through just to avoid a little bit of work.
|
|
|
|
|
I want to listen ip host with a specified port number. But not local ip address. I've tried to do it using three classes IPEndPoint, Socket, NetworkStream, but I couldn't see any data (in a MessageBox for example). I use:
private static string connectSocket(string address, int port)
{
//address = "10.0.105.4";
//port = 4000;
String data = null;
try
{
Byte[] bytes = new Byte[256];
IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse(address), port);
Socket socket = new Socket(endPoint.AddressFamily,
SocketType.Stream, ProtocolType.Tcp);
socket.Connect(endPoint);
NetworkStream ns = new NetworkStream(socket);
Int32 i;
while((i = ns.Read(bytes, 0, bytes.Length)) != 0)
{
data = System.Text.Encoding.ASCII.GetString(bytes, 0, i);
}
return data
}
Does anyone know how to solve this?
|
|
|
|
|
Err... The line that goes:
data = System.Text.Encoding.ASCII.GetString(bytes, 0, i);
Should you appending? i.e.
data += System.Text.Encoding.ASCII.GetString(bytes, 0, i);
It is that simple, just adding the data += instead of data = ?
- Eitsop
What we do not understand we do not possess. - Goethe.
|
|
|
|
|
Thanks but still it should return to me any data without appending.
|
|
|
|
|
How to get the checked items in a checkedListBox?
I don't want a return value of CheckedListBox.CollectionItems
i want it as a string array.
thanks
|
|
|
|
|
Get the collection returned by CheckedListBox.CheckedItems , create a string array of the same size as the collection and for each collection item put an appropriate string into the array.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
hi there
i saw a lot of Example and Article for Delegate and Events
i need to know where to use delegate and events
let's say for example
user need 2 insert in args 3 parameter
//static void Main(string[] args)
like add 2 3 //program will output 5
or sub 3 2 //program will output 5
can i use delegate here ???
without ask if add or sub
can somebody give me example from life?
thanks in advance
|
|
|
|
|
To start with -
A Delegate is a pointer to a function
An Event is a collection of delegates.
<br />
<br />
public void Run()<br />
{<br />
int i = Add(a,b);<br />
Console.Write(i);<br />
}<br />
<br />
public int Add(int a, int b)<br />
{<br />
return a + b;<br />
}<br />
<br />
will do exactly the same as
<br />
delegate void Adder(int a, int b);<br />
<br />
public void Run()<br />
{<br />
Adder a = new Adder(Add);<br />
<br />
int i = a(a,b);<br />
<br />
Console.Write(i);<br />
}<br />
<br />
public int Add(int a, int b)<br />
{<br />
return a + b;<br />
}<br />
<br />
For more information on events, create a windows form application and do a tutorial.
Hope that helps
Tris
|
|
|
|
|
hi tris
thanks for the answer
i know how to use delegate and events
all the article explain how to use delegate and events
but not when or where to use it
i found some example for delegate
let's say if we need to sort some array once Ascending
and once descending without change the function BubbleSorter
we use delegate
delegate bool CompareOp(object lhs, object rhs);
class MainEntryPoint
{
static void Main()
{
Employee [] employees =
{
new Employee("Bugs Bunny", 20000),
new Employee("Elmer Fudd", 10000),
new Employee("Daffy Duck", 25000),
new Employee("Wiley Coyote", (decimal)1000000.38),
new Employee("Foghorn Leghorn", 23000),
new Employee("RoadRunner'", 50000)};
CompareOp employeeCompareOp = new CompareOp(Employee.RhsIsGreater);
BubbleSorter.Sort(employees, employeeCompareOp);
PrintEmployee(employees);
CompareOp employeeCompareOp1 = new CompareOp(Employee.RhsIsSmall);
BubbleSorter.Sort(employees, employeeCompareOp1);
PrintEmployee(employees);
Console.ReadLine();
}
private static void PrintEmployee(Employee[] employees)
{
for (int i=0 ; i<employees.length ;="" i++)
="" console.writeline(employees[i].tostring());
="" }
="" }
="" class="" employee="" :="" object
="" {
="" private="" string="" name;
="" decimal="" salary;
="" public="" employee(string="" name,="" salary)
="" this.name="name;
" this.salary="salary;
" override="" tostring()
="" return="" string.format(name="" +="" ",="" {0:c}",="" salary);
="" static="" bool="" rhsisgreater(object="" lhs,="" object="" rhs)
="" emplhs="(Employee)" lhs;
="" emprhs="(Employee)" rhs;
="" (emprhs.salary=""> empLhs.salary) ? true : false;
}
public static bool RhsIsSmall(object lhs, object rhs)
{
Employee empLhs = (Employee) lhs;
Employee empRhs = (Employee) rhs;
return (empRhs.salary < empLhs.salary) ? true : false;
}
}
class BubbleSorter
{
static public void Sort(object [] sortArray, CompareOp gtMethod)
{
for (int i=0 ; i
|
|
|
|
|
hi again
sory for long code before
events
scenario for events
driving in the race car
need to alert driver
when the fuel gone finish
with red lamp on display
how my program ready for this scenario??
how can i fire event for this
thanks in advance
roni
|
|
|
|
|
Hello,
I have HtmlElementCollection object. Althought it is a collection, it does not have the Sort() method. How can I sort that collection using IComparer interface? Same goes for FileInfo[] object, it does not have Sort() method, and I need to sort that as well.
Thank you.
|
|
|
|
|
Don't have a solution for the collection problem, but to sort an array you can use an overload of the static Array.Sort method.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
See this[^] article.
/ravi
|
|
|
|