|
Christian Graus wrote: 2 - young people have always found new ways to express themselves, so that us old folks can't understand them.
Which is ofc stupid when they need adult assistance. OTOH I can believe it readily enough remembering how much trouble I had getting through to my brother that even if his friends all emailed back and forth in smsspeak (which was doubly sad since he didn't have a cell at the time) without capitals or punctuation it's not an acceptable style to use if trying to get advice from a college prof on a science fair project. I (think I) finally did get through to him and he's generally used something resembling English when emailing me since but getting past 'all my friends do it this way' was maddening.
--
You have to explain to them [VB coders] what you mean by "typed". their first response is likely to be something like, "Of course my code is typed. Do you think i magically project it onto the screen with the power of my mind?" --- John Simmons / outlaw programmer
|
|
|
|
|
well.. i know hell more bout C#
probably not bout directx and i dont think its needed!
i know physics..
i know i have to write code..
but i just dont know how to start.. where to start from?
how to move out images? i mean.. all dat crap!!
|
|
|
|
|
Hi Chumairr
You hell know more about C# , so we won't get any more programming posts. But, if you want tricks and tips about writing pool / snooker software - this is a good site to start with.
Good luck!!
http://www3.sympatico.ca/eric.perreault/tipshtml.html[^]
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
|
|
|
|
|
Please read the forum guidelines. Hightlights include:
1. Do not use text speak.
2. We are here to help with code you are stuck on, not to do your homework/job for you.
______________________
stuff + cats = awesome
|
|
|
|
|
Hi everyone,
I'm trying to write a simple swap function for two items in a combo box (this is used for moving an item in a combo box up or down depending on the button the user clicks).
My problem is that when I set ComboBox.DroppedDown = true, when the user clicks the button again while it is dropped down, (or anywhere else besides the combo box) it switches back to selecting the index that was initially selected. This is a problem when they want to move the same item more than one position -- it doesn't follow the user's selection.
private void SwapFrameNames(int oldIndex, int newIndex)
{
cmbFrames.DroppedDown = true;
object temp = cmbFrames.Items[newIndex];
cmbFrames.Items[newIndex] = cmbFrames.Items[oldIndex];
cmbFrames.Items[oldIndex] = temp;
cmbFrames.SelectedIndex = newIndex;
}
The code works fine if I comment out the first line of the function -- it follows the selection as expected.
Any ideas?
Thanks,
Phil
|
|
|
|
|
Not really a fix, but the swap is going to take a split second to occur, right ? So why not drop it AFTER doing the swap, if having it open stops the swap from working ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi Christian,
Thanks for your suggestion, doing as you said fixed the problem of it not following the user's selection, but it uncovered what was part of the root problem: when the ComboBox is open, and the user clicks anywhere that isn't part of the dropdown/box, it consumes the mouse event(s) so that the button that is clicked on is not activated -- this means the user has to click twice to continue moving the item down the list.
So I guess this is a new question now: is there any way to pass the mouse events on to the rest of the form after the dropdown closes itself?
Thanks again,
Phil
|
|
|
|
|
Hi Phil,
two ideas:
1.
the DroppedDown property manipulation should not be there at all; it is not
needed to swap frame names; if your app needs it, put it elsewhere (or
modify your method name)
2.
you might want to use SelectedItem instead of SelectedIndex; this should
even work if the selected index is different from oldIndex/newIndex;
it will fail if your ComboBox holds duplicates (not a good idea anyhow)
private static void SwapFrameNames(ComboBox cb, int oldIndex, int newIndex) {
object sel=cb.SelectedItem;
cb.SelectedItem=null;
object temp = cb.Items[newIndex];
cb.Items[newIndex] = cb.Items[oldIndex];
cb.Items[oldIndex] = temp;
cb.SelectedItem=sel;
}
Hope this helps.
|
|
|
|
|
I wasn't sure where to put this dilemma, but here it goes.
I have a web application wrapped around a state machine workflow that allows the user to pick search parameters from one content pane and then displays the results in the parallel pand via a gridview. I've wrapped both panes in and am using ajax extenders (Calendars and Watermark) in the search pane. I also have the search parameters saved into a Dictionary object.
Unfortunately this is slowing down this portion of the application to a crawl. I'm at a loss as to what is causeing the delays, which happen both on ititial page load and when search button is clicked. I'm using some ajax extenders in other portions of the application with no detriment. I would provide code samples if you think they'll help, just ask
Any suggestions or leads would be much appreciated.
Thanks,
An American football fan -
Go Seahawks!
Lil Turtle
|
|
|
|
|
AJAX means I'd have stuck with the ASP.NET forum ( where you've also posted this )
Perhaps your code is making too many AJAX callbacks and that is slowing it down ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I was maybe thinking that the ajax may have been slowing down the Dictionary of search parameters, the search inputs first try and get any previous parameters when the page is initialized.
Sorry for cross posting, I was just trying to cover my bases.
Thanks for the response, I'll look into it.
An American football fan -
Go Seahawks!
Lil Turtle
|
|
|
|
|
How do you build up the rows in your grid? Do you create an array of rows and add them all at the end, or do you add one at a time?
I've seen codes adding items to DataGridView one at a time and I think the grid does some 'OnAddedItem' handling like trying to refresh etc because when I changed it to adding arrays of data instead, the processing time was cut down to 1/3d.
-Larantz
|
|
|
|
|
Larantz wrote: How do you build up the rows in your grid?
I retrieve a Data Set from a database table via NetTiers.
How did you handle populating the GridView? Using the DataBound to create array, then ItemCreated?
Thanks for the insight though.
An American football fan -
Go Seahawks!
Lil Turtle
|
|
|
|
|
Could be viewstate "bloat". Are you using firefox with firebug? If so you can check out the http requests and responses in the console window and see what's being passed back and forth.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
I have all the AJAX extensions set to disable ViewState already, but thanks.
Steve Echols wrote: If so you can check out the http requests and responses in the console window
Is there a way to do this in IE?
Cheers
An American football fan -
Go Seahawks!
Lil Turtle
|
|
|
|
|
There's a tool called Fiddler[^], but I can't get it to work on my machine. You might have better luck though!
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Chris McGlothen wrote: I retrieve a Data Set from a database table via NetTiers.
Ok.With DataSet I don't think the row generation is an issue.
Chris McGlothen wrote:
How did you handle populating the GridView? Using the DataBound to create array, then ItemCreated?
Well in a normal case I'd use BindingList to handle the populating of the grid. The example I was refering to before was initially just building up string[] arrays with column values and then adding them to the grid. As a quickfix I just changed that into creating arrays of finished DataGridViewCells and adding the entire array to the grid. If I had the time, I'd go for a BindingList though.
Best regards!
-Larantz
|
|
|
|
|
Nice!
Thanks for the tip. I've not had the opportunity to try using a BindingList yet, I'll have to give it a go.
Cheers
An American football fan -
Go Seahawks!
Lil Turtle
|
|
|
|
|
I have a text box & a property window.
The text box is read-only and displays C code. As the users change properties the C-code changes respectively. I've implemented this using Regex's replace function. However it is really really slow. Here's what I have
private void updateCCodeTextBoxWorker(int address, string name)
{
cCodeTextBox.SuspendLayout();
string pattern = name + @", 0x..";
string replace = String.Format("{0}, 0x{1:X2}", name, regData[address]);
Regex rgx = new Regex(pattern);
cCodeTextBox.Text = rgx.Replace(cCodeTextBox.Text, replace);
cCodeTextBox.ResumeLayout();
}
The string "name" is basically what I'm searching for and "regData[address]" is the value that's changing.
Is there a better way to do this? How can I make it faster?
Thanks,
--RB
|
|
|
|
|
Have you tried the RegexOptions.Compiled flag? It may help, since the search pattern will be compiled into the assembly, which yields in faster execution time
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi,
So for every property change, the code executes, creates a new Regex and
makes it Replace something. Regex is an expensive class by itself,
it has to either interpret your intentions, or, optionally generate compiled
code for it (more cost effective only when required over and over, not your case).
If the user types 5 characters for a property, it changes five times.
I would look for a way to run the code less frequently. Some ideas:
- let the user trigger the code by clicking a button or so (less comfortable);
- let a timer trigger the code; maybe have a scheme where the worker runs
say 3 seconds after the last change (i.e. every change starts/restarts a timer,
and only when the 3 seconds elapse is the code executed).
Hope this helps
|
|
|
|
|
Hi,
Am writing an .net windows application in which i have to connect to IBM MQ on remote machine running unix to post messages. This is a tool kinda thing for an enterprise application.
this is the code am using to connect to the MQ.
Code: ( text )
MQEnvironment.Hostname = hostName;
MQEnvironment.Port = port;
MQEnvironment.Channel = "SYSTEM.DEF.SVRCONN";
MQQueueManager qm=new MQQueueManager(queueMgr);
When i try to run the application it throws an exception in
MQQueueManager qm=new MQQueueManager(queueMgr);
Exception details :- CompCode 2 Reason 2035 ..from error code lookup i learnt that its MQRC_NOT_AUTHORIZED.
read somewhere that the user's credentials under whom application is run will be supplied for authorization automatically..if thats the case how is cross platform connectivity is possible...in my case mq client is on windows and
mq server is on unix.
Do i have to specify the userid,password for unix system to override this?
If so, how? MQQueueManager Class doesnt have a constructor that accepts userid/password as a parameter and MQEnvironment doesnt have a property for userid/password..
Am using Websphere Mq 5.3 ? Is the option to specify userid/password available in the latest version 6.0?
seems MQ classes for java have options to specify userid/password but .NET classes didnt.
am pulling my hair over this for the past 3 days...please help..
|
|
|
|
|
I have a variable
string input
How do i detect if variable has digit in it or an alphabet.
o O º(`'·.,(`'·., ☆,.·''),.·'')º O o°
»·'"`»* *☆ t4ure4n ☆* *«·'"`«
°o O º(,.·''(,.·'' ☆`'·.,)`'·.,)º O o°
|
|
|
|
|
t4urean wrote: How do i detect if variable has digit in it or an alphabet.
In terms of an exclusive or?
To check, if the string is a number:
int i = int.TryParse(input)
If it's just one digit:
int i = int.TryParse(input) and then i =< 9 && i >= 0
If it contains one or more alphabets:
bool b = Regex.IsMatch(input, "[a-zA-Z]")
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi,
you can walk the individual characters of the string:
for (int i=0; i<input.Length; i++) {
char c=input[i];
... do something with c
}
or equivalently (unless you want to change c, wouldnt work here):
foreach (char c in input) {
... do something with c
}
and you can use one of many many methods available in String class,
such as IndexOf() and Contains()
May I suggest you at least read the MSDN documentation on String class;
or better yet work your way through a introductory C# book.
|
|
|
|