|
You create a method on your form that sets whatever you need on the Timer control. You can check the InvokeRequired of the form instead of the Timer control. Since the form's based Timer works on the UI thread, the Form is on the same UI thread and will tell you if InvokeRequired.
You Invoke the method you write from your other thread...
|
|
|
|
|
Hello,
I am working on VB.net form based application. I am having one user conrtol on the main form with some context menu item on it. All the handlers of these context menu items are implemented in the user control.
I want to implement all these context menu items on the main Menu of the main form. Now i want to call the same handlers of the context menu from my main menu.
How should i invoke the handlers form other class?
thanks in advance.
gajesh
|
|
|
|
|
the handler in the control should be like this:
public overridable sub .....handler....
or
protected overridable sub .....handler....
and in the form u can call them like this:
public overrides sub ....handler....
...or u can make a public event in the control
...or make them all public and handle their events directly in your form
A.E.K
|
|
|
|
|
'Start Word and open the document template.
Set oWord = CreateObject("Word.Application")
oWord.Visible = True
Set oDoc = oWord.Documents.Add
oDoc.PageSetup.Orientation = wdOrientLandscape
oDoc.PageSetup.LeftMargin = 10
oDoc.PageSetup.RightMargin = 10
oDoc.PageSetup.TopMargin = 30
'Insert a paragraph at the beginning of the document.
Set oPara1 = oDoc.Content.Paragraphs.Add
oPara1.Range.Text = "Diamant Drilling Services Run Report"
oPara1.Range.Font.Name = "Arial Rounded MT Bold"
oPara1.Range.Font.Color = wdColorBlue
oPara1.Range.Font.Size = 28
oPara1.Range.Font.Bold = False
oPara1.Range.InsertParagraphAfter
oPara1.Range.InsertParagraphAfter
Set oPara1 = oDoc.Content.Paragraphs.Add
oPara1.Range.Text = "QDC"
oPara1.Range.Font.Name = "Arial"
oPara1.Range.Font.Color = wdColorBlue
oPara1.Range.Font.Size = 8
oPara1.Range.Font.Bold = True
Ok, there is the code that opens word, opens a new document and starts to insert some things into it. my problem begins with the last block of code. once it has written the word "QDC", how do i then write another word after it on the same line without overwriting the "QDC"
I am extracting info from a database and the recordset is going to be used to populate the document. So you will have the following senario:-
QDC TYPE NUMBER
SPH423 PDC S6L1543
the second line contains the data that is extracted from the database and has to be inserted under the relevent "column headings". there might be only one record or there might be over 200, depends on what the user has searched for.
Any ideas on how to do this guys?
|
|
|
|
|
Use the InsertAfter method. It'll move the insertion point to the end
of the insert text, ready for your next insertion. You can also use
TypeText but can't remember whether that moves the insertion point or not.
Some similar to...
Set oPara1 = oDoc.Content.Paragraphs.Add
oPara1.Selection.InsertAfter "QDC"
|
|
|
|
|
Hi! All,
I have to create CSV file using data of a table. Can anybody help me on this issue?
Thanks and Regards,
Virendra
|
|
|
|
|
You forgot to say VB6 this time. VB6 is a dead language, people will assume .NET unless you say otherwise.
Which bit can't you do ? Do you have the data from the table ? Do you know how to create a file ? If you broke this into it's three obvious parts and googled, I'm sure you'd find the help you need.
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 i am trying to read the following xml file
<sessionrequest schemalocation="\WEB-INF\xml\schema\Application.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<requesttype>APPLICATION
<token>
<requestarguments>
<application>
<companyid>TT0010001
<requesttype>APPLICATION
<application>FUNDS.TRANSFER
<version>,BM
<function>I
<operation>PROCESS
<transactionid>NEW<compscreen>MAIN
<message>
<field>
<fieldname>TRANSACTION.TYPE
<value>AC
<field>
<fieldname>DEBIT.ACCT.NO
<value>0110000020000005
<field>
<fieldname>DEBIT.CURRENCY
<value>USD
<field>
<fieldname>DEBIT.AMOUNT
<value>78
using the following code
Dim readx As XmlReader = XmlReader.Create("C:\Documents and Settings\gurubala\Desktop\1-1.t24txn.xml")
While readx.Read
If readx.NodeType = XmlNodeType.Element Then
MsgBox(readx.Name.ToString & " : " & readx.ReadString)
End If
End While
the problem here is it reads the nodes and values but starts to skip firstnode <message><field> ... it leaves <fieldname> element and reads <value>
why this happens how to avoid this
thanks
with regards
Balagurunathan.B
|
|
|
|
|
<SessionRequest schemaLocation="\WEB-INF\xml\schema\Application.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<requestType>APPLICATION</requestType>
<token></token>
<requestArguments>
<Application>
<companyId>TT0010001</companyId>
<requestType>APPLICATION</requestType>
<application>FUNDS.TRANSFER</application>
<version>,BM</version>
<Function>I</Function>
<Operation>PROCESS</Operation>
<transactionId>NEW</transactionId>
<compScreen>MAIN</compScreen>
<message>
<field>
<fieldName>TRANSACTION.TYPE</fieldName>
<value>AC</value>
</field>
<field>
<fieldName>DEBIT.ACCT.NO</fieldName>
<value>0110000020000005</value>
</field>
<field>
<fieldName>DEBIT.CURRENCY</fieldName>
<value>USD</value>
</field>
<field>
<fieldName>DEBIT.AMOUNT</fieldName>
<value>78</value>
</field>
<field>
<fieldName>DEBIT.VALUE.DATE</fieldName>
<value>20061005</value>
</field>
<field>
<fieldName>CREDIT.CURRENCY</fieldName>
<value>USD</value>
</field>
<field>
<fieldName>CREDIT.VALUE.DATE</fieldName>
<value>20061005</value>
</field>
<field>
<fieldName>CREDIT.ACCT.NO</fieldName>
<value>0110000020000017</value>
</field>
<field>
<fieldName>CHARGES.ACCT.NO</fieldName>
<value>0110000020000005</value>
</field>
</message>
</Application>
</requestArguments>
</SessionRequest>
the problem here is it reads the nodes and values but starts to skip <message>---> <field>`s firstnode ... it leaves <fieldname> element and only reads <value>
why this happens how to avoid this
with regards
Balagurunathan.B
|
|
|
|
|
Hi friends,
I am using VB6 at front end and SQL/SERVER 2005 on back end. Now i need to save pictures (in jpeg or bmp) in SQL database. And i have to display it on front end when it needs. I saved one image into database into a table field of type 'image'. It was saved. Is this the correct way to save picture in database?. Then how can I display this file in VB6.
by Dileeeeeeeeeeeeeeep.
|
|
|
|
|
How I can Add Templates Column at Run Time in the .aspx Page in VB.NET
yogesh
|
|
|
|
|
You can't, the aspx is processed before the code behind. Your best bet is probably a repeater, which means you have full control over what is rendered, and can better change it at runtime.
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 all
I have a game where i input winning items each with a number and picture. I enter only winning numbers in xml file so when any one plays the game, he/she only wins if winning number is entered. I dont have a ratio for winning items. What i want is to apply a random ratio for winning items.
Forexample out of 100% wins i want the wins to be as follows:
20% item1
30% item2
25% item3
25% item4
please note that in the game i can add as many items as i want.
Any ideas and thanks
|
|
|
|
|
Set up your percentage, then use a random number generator. In the example above, get a number between 1 and 100. 1-20 is item1, 21-50 is item2, 51-75 is item3, 76-100 is item4.
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 )
|
|
|
|
|
Christian Iam still confused about setting up items. The case is that i dont have a fixed number of items to set up percentages, the items may vary from one time to another. If this is the case how it is this doable?
Lets suppose i fixed my winning item number to 4 items with percentages (40,30,20,10)and i used the random function
Dim RandomNumber1 As Integer
RandomNumber1 = RandomClass.Next(0, 40)
Dim RandomNumber2 As Integer
RandomNumber2 = RandomClass.Next(41, 70)
Dim RandomNumber3 As Integer
RandomNumber3 = RandomClass.Next(71, 90)
Dim RandomNumber4 As Integer
RandomNumber4 = RandomClass.Next(91, 100)
Then what?
Then only if i chosed a number between 91 & 100 i win an item4 and so on, which is not my case. I want a ratio of (40,30,20,10) of the four existing items and a ratio of (35,25,15,15,10) of my five items and so on.
Any ideas and thanks
|
|
|
|
|
If the list is random, how is the spread going to be set ? If it's not also random, then you can store a list of values to compare against, to get the same end result.
samerh wrote: RandomNumber4 = RandomClass.Next(91, 100)
This is not what I said. Take ONE random number between 1 and 100, then work out which interval it fits into. That's how you get your percentage spread. This make not give you any hits at all.
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 )
|
|
|
|
|
if you want to assign to each item a random percentage, dynamically, use the following:
(1) Assign to each item ratio a random number
(2) rescale the assigned ratios to sum up to 100 (i.e. normalize).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Yeah, that's what I said.
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 )
|
|
|
|
|
Hello
Can you provide me a simple function of how to use Progress bar while pulling an unknown number of data from a database
thx
Regards
Ramy
|
|
|
|
|
Quite plainly, if you don't know how much data you are getting, there's no way you can show a real progress bar. You should also try to make your database call all in one go, not breaking it up into many calls if you can help it.
Your best bet is to set a progress bar to just show indeterminate progress ( the bar moves over and over ) and leave that showing while a thread does your DB call.
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 )
|
|
|
|
|
ya tats right.. i had posted the same question days ago, and got the same answer from the members of this group. Any ways, try to loop the value of the progressbar with the number of recordsets you want to load. Place the function in a timer with an interval of say 1000 ms.
hope this works..
The name is Sandeep
|
|
|
|
|
Kindly,Provide me a simple code for that
thank you
Regards
Ramy
|
|
|
|
|
What he has suggested is plain not going to work. Set your progress bar Style property to Marquee and do what I said, there is just no way you can show a progress bar for an unknown number of items.
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 )
|
|
|
|
|
Thx for ur help
I really appreciate it. ( and i m not complaining)
all what i ask is a simple code please
thx
Regards
Ramy
|
|
|
|
|
If you set the progress bar style to marquee, it will display itself automatically. Just put one on your form, and then do your database call in a thread. When the thread ends, get rid of the progress bar. I'm sorry, but I don't write VB, and really, there's no code that I can show you, you need no code for the progress bar, and I don't know how your database call is written.
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 )
|
|
|
|