|
hi all,
i am creating add-ins in excel 2007 . In my application, i use some form . i want to that if user change the theme/color of excel then this change is also applied on my form.
anybody have idea that how can i perform this task ?
if possible ,then Please provide some code snippet.
thanks
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
I have a table's field that "Date". It contains severial data, some are same.
(Eg. 20/11/07
20/11/07
20/11/07
25/12/07
25/12/07
25/12/07
27/12/07
27/12/07
29/12/07
29/12/07
30/12/07
31/12/07 ,etc...)
20/11/07 is 3 data.
25/12/07 is 3 data.
27/12/07 is 2 data.
29/12/07 is 2 data.
30/12/07 is only one data.
31/12/07 is only one data.
I wanna display the above data onto a ComboBox by desending. I wanna collect only one data for a same many data.
(Eg. 31/12/07
30/12/07
29/12/07
27/12/07
25/12/07
20/11/07
... etc )
Please give me some suggestion for above metter.
|
|
|
|
|
You need to check if a value is in the list already before you add it. IF you're getting data from a SQL source, use the UNIQUE keyword to get unique values.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hi..,
i am trying to give you 2 suggestion.
1. Try to retrive the unqui date from data base. when you are retriving data from dbase base
user "distinct" keyword in query
Ex: select distinct mydate from mytable.
or
2. use the below logic.
dim innlop,temploop
dim dupflad as boolen=false
combobox1.items.clear
For innlop = 0 To ftp_ds_NT.Tables(0).Rows.Count - 1
dupflad =false
for temploop=0 to combobox1.items.count -1
if ftp_ds_NT.Tables(0).Rows(innlop)(0) )=combobox1.item(temploop)
dupflag=true
end if
next temploop
if dupflag=false then
combobox1.items.add(ftp_ds_NT.Tables(0).Rows(innlop)(0) ))
end if
Next innlop
********* Please Ignore the syntex errors **************
thanks
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
A nested loop is always expensive, and for loops are always nastier to read than for each, but in this case, just combobox1.Items.Contains would work. You could also replace the dupflag variable with a simple continue statement.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hi...,
So that i can remove one loop., nice ... , i accepted.
Thanks Christian Graus
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
Hi! I've converted a vb6 project to vb.net project, I'm using crescent (IIIrd party control)combo box in this project. The problem is sometimes combo boxes do not display data but actually data is there as seen from Immediate window and by displaying through message box. But sometimes combo boxes do not display the data. I'm not sure what the problem could be? I would like to add that same code in vb6 is running perfectly fine. Have any of you come across such a problem. Any help is appreciated.
Thanks
Don't Quit
modified on Tuesday, March 18, 2008 2:43 AM
|
|
|
|
|
Show us the code that do that
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
This would be a question for the manufacturer of the control library, Sax.net[^]. You may also want to find out if they have an updated control library for .NET Framework applications.
|
|
|
|
|
I try to call txtrefno_KeyPress(txtRefNo, e) from form_load event but it throws exception saying "Unable to cast object of type 'System.EventArgs' to type 'System.Windows.Forms.KeyPressEventArgs'."
How do I overcome this problem ?
' Code which throw an exception:
Private Sub frmNewReceipt_Entry_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
txtrefno_KeyPress(txtRefNo, e) ' this point it throw an exception
End Sub
Private Sub txtrefno_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtRefNo.KeyPress
'' code
End sub
|
|
|
|
|
Try here[^]. I've give you a clue, did you read the error ? Did you look at the definition of the two methods ?
What's the point of calling an event handler for a key press, if you don't specify what key was pressed ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hi...,
Very simple.
Your passing wrong arugument to keypresee method.
u have to pass the System.Windows.Forms.KeyPressEventArgs argument instad of System.EventArgs
use this below code and slove your problem.
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim temp As System.Windows.Forms.KeyPressEventArgs
Call TextBox1_KeyPress(sender, temp)
End Sub
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
MsgBox("Rajesh B --> A Poor Workman Blames His Tools <--")
End Sub
Thanks
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
The big question is, what on earth would you do this for ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
What do you meen????
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
I mean, your answer is right, I just don't get what this could achieve. The point of the keypress event is surely to respond to the key that was pressed. Why does hte OP want to call it, without specifying a key that was pressed ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Dear Christian Graus,
i am sorry .., may be i am going wrong.
The Q. is asked by kalikarr, he wants to call the keypress event in the form load. So before not loading the form he wants to call the event. I think no superman can't enter a value before loading the form. So that i passing a dummy value to that method to fire. however i think that(temp) will also have the value of '0x00'.
replay me.
Thanks.
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
You have totally misunderstood me.
Your answer is fine. I am saying, I don't get what the original poster hopes to achieve with code like this, as the code in a key press event generally checks what key was pressed, in which case it would do nothing, or if he has an action he performs on any key being pressed and wants to perform that same action at startup, he should factor it out into a method. I am saying the person who asked the question has design issues, not criticising your reply.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
i want to navigate backeard and forward in my code window
how to do that with a short key,
hello
|
|
|
|
|
ghumman63 wrote: i want to navigate backeard and forward in my code window
how to do that with a short key,
you can find these shortcuts by going to menu Tools->Options->Environment->KeyBoard, there you will find an edit box having label "Show commands Containing:", there you should type "View.N"(without quotes) then you will find the shortcuts of Navigate Forward and Navigate Backward.
In short you can find shortcut of any menu or you can even customize that.
Regards,
Mushq
|
|
|
|
|
I am currently writing an application that launches and manipulates other programs. I currently launch another application through the use of the process class, and since I need to manage many other applications, I just store the MainWindowHandle value into an array, and dispose the process object that I had created.
The problem that I am having is, when it comes time to manipulate the application, I do not know whether the application is still running or not(has the user closed it?). Is there a Windows API that returns values based on a window handle? Is there any alternative to using an API to accomplish this?
Would I be better off creating an array of processes, eg Dim myArray() as Process ?
Any suggestions are greatly appreciated
modified on Monday, March 17, 2008 11:42 PM
|
|
|
|
|
You could store the actual process object in an array or you can use the Process.GetProcessByName[^] method to find the process again. You would want to store the process name (the name of the executable) rather than the handle.
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
Thanks for the advice. Storing the process in a process array makes things a lot easier.
Thanks,
Mitch
|
|
|
|
|
You're welcome. The one thing to keep in mind when doing that is going to be how long you must keep those references and how many of them you will be keeping. Holding a bunch of Process objects in memory in an array will consume a lot more memory than just holding a string value of the process name. If you won't need access to the Process information for a while (or are passing the array around as a function parameter) you really should think about just keeping the process name and only creating a Process object as needed.
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
You are correct. When I changed out my process array for just a regular array, I had saved quite a bit of memory. I am also able to get the process by using the GetProcessById method. However, once I call theProcess.HasExited method, I get a "Win32 Exception: Access is Denied".
[Edit]
With a little more digging around in my code, it seems that my error is being caused earlier in my code.
Dim newApp As Process = New Process
newApp.StartInfo.FileName = appSelPath
newApp.StartInfo.WindowStyle = ProcessWindowStyle.Normal
newApp.Start()
However, when I call newApp.MainWindowHandle to store the value in the array (I need to use this for Windows API's), it returns 0.
Thanks for your time,
Mitch
|
|
|
|
|
That is probably a better solution since you are the one starting the processes you will have access to the process Ids.
There are situations where Process.HasExited will throw a Win32Exception so you will still want to trap for that error and handle it appropriately. This mostly occurs when the exit status can't be returned for some reason.
As for MainWindowHandle returning 0, this is also a legal value. A process has a main window associated with it only if it has a graphical interface; otherwise MainWindowHandle will be 0. Take a look at WaitForInputHandle[^] to allow the process to finish startng.
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|