|
Hey fellow developers,
Need help with a datagrid column...
In design time i have created a datagrid with 2 columns one is a DataGridViewComboBoxColumn type column the other is just plain text.
I am inserting data into the comboboxcolumn's items collection during runtime but when it has finished inserting into the items collection and i go to click the drop down button it does nothing.
The items are coming from a datagrids header text row.
code below;
for (i = 0; i < dataGrid.ColumnCount; i++)
{
MCForm.FileColumn.Items.Add(dataGrid.Columns[i].HeaderText.ToString());
//FileColumn is the name of the column which is set as a combobox column
}
Any idea's...
I have run through in debug mode and in the runtime properties it shows that there is items in the control but it just wont reflect back when i click the combobox button to show the items in the list.
Any help asap would be fantastic
|
|
|
|
|
Hi,
I have 6 groupBoxes with similar content. In otherwords groupBoxUnit1, groupBoxUnit2 thru groupBoxUnit6.
The number of units (1 thru 6) is entered by the user and I only want the form to display that number of units groupBoxes. For example, if there are 5 Units - display groupBoxUnit1 thru groupBoxUnit5.
I can do this with a CASE statement and a lot of typing and will be surprised if there isn't an easier alternative.
Any suggestions.
TIA
Glen Harvy
|
|
|
|
|
Put references to the controls in an array:
GroupBox[] groupBoxes = new GroupBox[] { groupBoxUnit1, ... , groupBoxUnit6 };
Now you can access them by index, so that you can loop through them and show the ones you want.
---
single minded; short sighted; long gone;
|
|
|
|
|
I thought of this but can't get my mind around it.
Can you give me some psuedo code as a hint
Glen Harvy
|
|
|
|
|
Something like this:
int visibleCount = 4;
for (int i = 0; i < groupBoxes.Length; i++) {
groupBoxes[i].Visible = (i < visibleCount);
}
---
single minded; short sighted; long gone;
|
|
|
|
|
Thanks for the help - much appreciated.
Glen Harvy
|
|
|
|
|
I have a form that runs a ftp call on load (or suitable event), however when the form loads it completely freezes will the ftp call is running. Is there a straight forward way of making the form still usable while the ftp call is running? Am I looking at a asynchrous call or something like that? I sort of got what I wanted by using threading but for some reason i couldn't close the form even when the method was done executing (seems like the thread was still running (how do you stop it?)
Cheers
|
|
|
|
|
Hi,
IMO you should do networking stuff in a separate thread, so have your Load event create
and start a thread. Be careful with the GUI tho, only the main thread is supposed to
(or allowed to) access GUI components, see the InvokeRequired and Invoke/BeginInvoke
property and methods.
You can find a simple example of a thread and the Invoke stuff in my Sokoban article;
there are alternative kinds of threads (with ThreadPool, BackgroundWorker, etc).
|
|
|
|
|
hi,i have created the editor in RichTextBox control
and implemented the goto line number functionality.
now I want to find the content length of the perticular line.
Thanks
|
|
|
|
|
Measure the text between the two return characters in the string.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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,
actually not clear can u elabarate it.
I think u got my problem
when ever u compile a program if it leads to any error if we double click that error that it will lead to an corresponding line where that error has been occured.
At present I am able to point to the error line but not the entire line is highlighted.
Thank you.
With Regards
Prasad
|
|
|
|
|
If you walk the characters going back from the position you're at, you will find a return character, or 0. If you go forwards, you will find a return character, or the end. This will tell you the length of the substring to highlight. The return has an integer value of (decimal)13. Environment.NewLine is two characters, 10 and 13.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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,
sorry i am not getting can u give one code example pls
help me pls
Thank u
|
|
|
|
|
a string contains chars.
foreach (char c in "abcdefg")
will iterate over each charater. You can do it by index, too.
string s = "spit";
s[1] = 'h';
for example.
So, you can take the location of hte cursor, and then look back and forwards for the return character.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
Thank you
it is working
With Regards
prasad
|
|
|
|
|
I have a popup displayed with a form by function:
taskbarNotifier1.Show("HostName: \n\n SiteHit: \n\n Survey: \n\n TAF: \n\n ATO: ", strQuery, 300, 2000, 300);
Now these hostname,survey,taf,ato i have to get from database :
select url,sitehit,survey,tellafriend,addtooutlook from tblsummary where...
of current datetime ie the last current entry of database and display all these data in 'strQuery' in above function in a line ie one after other like this :
Hostname : nekshan@yahoo.com
Sitehit : 1
Survey : 0
These in bold are data to be displayed by the query.
how to get all this data in one variable to put it in my function n display data in this format.
Hope u r getting my Point.
Thanx
nekshan.
|
|
|
|
|
Create a struct to hold all this data, if you want to pass it all in one go.
Or, if it has to be a string, use a delimiter or build a query string, like a URL.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
function can only return one value
so if u want all three then u have to concat all in one variable like
str = str1 + '#' + str2 + '#' + str3
then return str from function
now on form u have to seperate all three from str by using mid(str,'#',1) like this not exactly this function is. u have to seperate like this all in different variable then use it.
bye. virendra.
|
|
|
|
|
Yeah, that's one of the answers I gave. Why did you give it 4 times ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
function can only return one value
so if u want all three then u have to concat all in one variable like
str = str1 + "#" + str2 + "#" + str3
then return str from function
now on form u have to seperate all three from str by using mid(str,'#',1) like this not exactly this function is. u have to seperate like this all in different variable then use it.
bye. virendra.
|
|
|
|
|
function can only return one value
so if u want all three then u have to concat all in one variable like
str = str1 + "#" + str2 + "#" + str3
then return str from function
now on form u have to seperate all three from str by using mid(str,"#",1) like this not exactly this function is. u have to seperate like this all in different variable then use it.
bye. virendra.
|
|
|
|
|
function can only return one value
so if u want all three then u have to concat all in one variable like
str = str1 + "#" + str2 + "#" + str3
then return str from function
now on form u have to seperate all three from str by using mid(str,"#",1) like this not exactly this function is. u have to seperate like this all in different variable then use it.
bye. virendra.
|
|
|
|
|
Hi i am diplaying a windows control in my web page (aspx page), so i am embedding the object in the html code as shown below,
<object id="AMATGraph1" height="100%" width="100%" align="middle" border="0" classid="http:/RSWEB/SmartClients/AMATGraph_" +="" amat.web.defines.getsmartclientversiondirstring()="" "="" amatgraphing.dll#amatgraphing.controls.amatgraphcontrol"="" viewastext="">");
<param name="Server" value="" + _server + "" />
<param name="Username" value="" +="" _username="" ""="" />
<param name="Password" value="" +="" _password="" ""="" />
<param name="HeaderVisible" value="false" />
<param name="FooterVisible" value="false" />
<param name="ControllerClass" value="" +="" _controller="" ""="" />
<param name="AccountName" value="" +="" _accountname="" ""="" />
Now, i want to capture onclcik event raised in windows application in my aspx page, how should i achieve this please advice
Thanks in Advance
|
|
|
|
|
I'm writing a client\server application, and I have a problem in server part because I want that part to manage more than one client at time, I used asynchronous operations and here comes the problem, I don't know how these function exactly works( I mean in the runtime environment) , this is the code summarized as possible, in the form constructer
server = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);
IPEndPoint ipep = new IPEndPoint(IPAddress.Parse("169.254.25.129"), 9050);
server.Bind(ipep);
server.Listen(-1);
server.BeginAccept(new AsyncCallback(AcceptConn), server);
The asynchronous callback function (AcceptConn) accepts one incoming connection and assign a socket to deal with this connection, and at the end of the function I call the BeginAccept function again to begin to accept other incoming connections.
I have a class ConnectionInformation to keep all the information a bout one connection, and the ConnSock is a property to access the socket member in the class
And the sockCount to keep track of instances of ConnectionInformation in the array connInfo.
public void AcceptConn(IAsyncResult iar)
{
Socket oldServer = (Socket)iar.AsyncState;
connInfo[sockCount].ConnSock = oldServer.EndAccept(iar);
connInfo[sockCount].ConnSock.BeginReceive(DataReceiveBuffer, 0, DataReceiveBuffer.Length,
SocketFlags.None, new AsyncCallback(ReceiveData), connInfo[sockCount].ConnSock);
FillInDataGridView(connInfo[sockCount]);
server.BeginAccept(new AsyncCallback(AcceptConn), server);
}
And in the asynchronous callback function(ReceoveData) for the BeginReceive operation I do the same
public void ReceiveData(IAsyncResult iar)
{
Socket remote = (Socket)iar.AsyncState;
int recv = remote.EndReceive(iar);
remote.BeginReceive(DataReceiveBuffer, 0, DataReceiveBuffer.Length, SocketFlags.None,
new AsyncCallback(ReceiveData), remote);
}
The problem is when I run the application, and after I run two client application, the server part stucks on the screen and refuse to do any thing,(note: I'm using datagridview to show connection information).
i didn't know what the problem since the compiler didn't show any error, is that because there is finite loops in the AcceptConn and ReceiveData functions, or do these operations took a lot of memory.
and what its better, using asycnh operations, or begining a thread and using blocking method indide these thread.
I need advise on hints, if there is other way easier than the code above I would appreciate to know about, or any other suggestion.
And thanks in advance.
|
|
|
|
|
How to protect code from reverse Engineering and get source code? As decompiler are easily available any one can easly get source code.Can Strong Name or obfuscator software guarantee source code protection.Is there any other technique apart from these?any other language like vc++ or java code have more security features ?
|
|
|
|