|
|
Thanks for the link.
Aaron Eldreth
TheCollective4.com
My Articles
While much is too strange to be believed,
Nothing is too strange to have happened.
- T. Hardy
|
|
|
|
|
i need to know of a way to make other variables pointers in vb.net. Is there anyway to do this. I know in 6.0 you could use the strptr or objptr or varptr. I need to know how to do this same function in .net.
|
|
|
|
|
Everything is a pointer (now called a reference) in .NET except for value-types (things like integers, booleans, floating point numbers, and so on).
I don't know how you would get a pointer in VB.NET, although you can do it in C# by creating some unsafe code - but VB.NET doesn't support the unsafe context.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
this is my initial variable:
Dim Operators() As String = {"=", "<=", ">=", "+", "-", "!="}
Dim Codes() As String = {"UC", "CT", "LS", "PR", "P1", "P2", _
"P3", "P4", "P5", "P6", "P7", "P8", "P9", "PQ", _
"QT", "PC", "SR", "MV", "SC", "DC"}
Could someone help me to how use regular expression to check an input of string is valid in the following order:
Codes Operators Integer
For example: UC = 3
Thanks.
John
|
|
|
|
|
Hi John. How about this regular expression?
^(UC|CT|LS|PR|P1|P2|P3|P4|P5|P6|P7|P8|P9|PQ|QT|PC|SR|MV|SC|DC)\s*(=|<=|>=|\+|-|!=)\s*\d+$
- The initial
^ makes the match at the beginning of the string (i.e. nothing can come before the code). - Next is a group of choices (your codes) surrounded by (parentheses) and seperated with vertical bars |.
- The
\s that follows means to match white space and the asterisk * says "zero or more times"... so the \s* allows for optional white space between the code and the operator. - Then the (=|<=|>=|\+|-|!=) group is another list of choices, seperated by
| , surrounded by (...) like before. The + sign has special meaning in regular expressions, so it requires an escape backslash \ character in front of it to treat it as a literal + sign. - Next we have another
\s* , again allowing for optional whitespace between the operator and the integer - We use
\d+ to match one or more digits from 0 to 9... the \d means match a digit, and the + means "one or more times". - Finally, the
$ dollar sign at the end matches the position at the end of the input string, meaning that no other characters may follow the digits.
I hope this helps.
|
|
|
|
|
Thank you so much. This really helps.
John
|
|
|
|
|
I have list of document of type word,pdf and tif images. When open the documents and print , i expect the printing resulted in the same order.
But the word documents are printed first and then pdf and the order is not what I printed.
How to avoid this jumble and maintain the order in which i printed.
Regards
Thangavel
|
|
|
|
|
How are you printing these documents? Are you selecting them in Explorer, right-clicking and picking Print?
Or are you trying to print these from code? What does your code look like?
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am trying to print them from code. Printing in a loop using the one of the following code for the respective documents .
'Print '.tif' image using Kodak Image Edit control.
imgEdForTIF.Image = gstrFilesPath & "\" & txtEDockets(intI)
imgEdForTIF.PrintImage
'Print for Word document
objWordApp.Documents.Open (gstrFilesPath & "\" & txtEDockets(intI))
objWordApp.ActiveDocument.PrintOut Background:=False
objWordApp.Documents.Close wdDoNotSaveChanges
'Print for PDF files
Call ShellExecute(hwnd, "Print", gstrFilesPath & "\" & txtEDockets(intI), "", "", 0)
lngHwnd = FindWindow(vbNullString, "Acrobat Reader")
SendMessage lngHwnd, WM_CLOSE, 0, 0
|
|
|
|
|
You're printing all of these nearly at one and depending on the Print routines for each to do the printing for you. Not a problem really, it's what anyone would do.
The problem your running into is that Word uses a background Print on a seperate thread. Your also using ShellExecute to Print .PDF files, which means Acrobat has to load, load it's plugin's and the load the document, then print. Takes a while...
With all the printing being done on seperate threads, it's, literally, a race to see which application can start it's print job first since they are all going at the same time.
The bottom line is, with the methods that you've chosen, there is no way to print the jobs out in any controlled order. You would have to either monitor the PrintQueue to catch when the job starts before firing off the next (not easy!), or you would have to monitor each application to see when it starts the actual printing (not easy!), or you could drop Thread.Sleep(oh I don't know, say5000)'s between each print job, thereby putting 5 seconds between the launch of each print job.
The final method works, is easy to implement, BUT (a very big BUT here!) It in no way guarantee's that the print jobs will come out in the order you launched them. The bottom line is there is no easy and reliable method to get the print jobs to come out in the order you want them.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks.
Putting the delay works , but i understand the risks.
Is there any other design i can choose to control the order of printing. USing PS or prn files?
|
|
|
|
|
Ummmmm...let me think about this...
OK. You MIGHT be able to getaway with this....
You could start all of your print jobs, but instead of printing to the printer, you would print to a printer object that was told to print to a file instead. This would send all of the page description code (PCL5, PCL6, PostScript, whetever it is...) to a file instead of the printer. You would have to wait until these jobs were completed. (I don't know your going to do this!) Then copy the files, in order, to another printer setup to go to the printer this time and redirecting LPT1: to it.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks for your time.
Actually I tried to read the print job status using a API:
A seperate program will polling and writing the status to aceess and after the print read command read the access to check if that document reached the status printing. here for very small documents i may not be able to read the status and that time i used to wait for 30 seconds.
This works fine but the pproblem now is that some of the PDF documents printed with only one page. The remaining pages are missing. I am giving the next print command only after the previous document status in printer is "printing".
The same behaviour when i print without any delay . But no missing of pages when i print with 15 second dely.
Any idea why this is happening.
Thanks and Regards
R Thangavel
|
|
|
|
|
I've never heard of the problem. Sounds like an issue with Acrobat, or whatever component is doing the printing.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi friends,
i have a datagrid in my project and i m using a datatable to fill the datagrid.the default preferredcolumnwidht property is set to 200.
but i want to use datagridtable style and disply the columns with different widhts but all efforts til now went in vain......
the code i used is pasted below..........
plz help me.
the code for style whihc i used is commented.....
hoping for quick solutions.....
Dim lDataTable As New DataTable("ItemList")
mintRecCount = Datasource.Length
lDataTable.Columns.Add("Code", System.Type.GetType("System.String"))
lDataTable.Columns.Add("Description", System.Type.GetType("System.String"))
lDataTable.Columns.Add("UOM", System.Type.GetType("System.String"))
lDataTable.Columns.Add("Quantity", System.Type.GetType("System.Int32"))
'lDataTable.Columns.Add("AltQty", System.Type.GetType("System.Int32"))
lDataTable.Columns.Add("Weight", System.Type.GetType("System.Single"))
lDataTable.Columns.Add("Price", System.Type.GetType("System.Single"))
For mRowIndex = 0 To mintRecCount - 1
lDataRow = lDataTable.NewRow()
'code for entering data into the datarow
lDataTable.Rows.Add(lDataRow)
Next mRowIndex
lDataTable.Columns(0).ReadOnly = True
lDataTable.Columns(1).ReadOnly = True
lDataTable.Columns(2).ReadOnly = True
lDataTable.Columns(4).ReadOnly = True
'Dim ts As New DataGridTableStyle
'ts.MappingName = "ItemList"
'Dim cs As DataGridTextBoxColumn
'cs = New DataGridTextBoxColumn
'cs.MappingName = "Code"
'cs.HeaderText = "Code"
'cs.Width = 64
'ts.GridColumnStyles.Add(cs)
'similiar code for other columns
'dgOrdInvAddItem.TableStyles.Add(ts)
dgOrdInvAddItem.DataSource = lDataTable
|
|
|
|
|
Here is some code I used in one of my projects and it worked quite fine. Hope it helps...
Private Sub setDGProperties()
dgDetails.TableStyles.Clear()
Dim dgts As New DataGridTableStyle
dgts.MappingName = "TransDetails"
dgts.AlternatingBackColor = Color.LightGray
Dim prod As New DataGridTextBoxColumn
prod.MappingName = "ProductID"
prod.HeaderText = "ProductID"
dgts.GridColumnStyles.Add(prod)
Dim cname As New DataGridTextBoxColumn
cname.MappingName = "ProductName"
cname.HeaderText = "Product Name"
cname.Width = 120
dgts.GridColumnStyles.Add(cname)
Dim quan As New DataGridTextBoxColumn
quan.MappingName = "Quantity"
quan.HeaderText = "Quantity"
dgts.GridColumnStyles.Add(quan)
Dim price As New DataGridTextBoxColumn
price.MappingName = "TPrice"
price.HeaderText = "Price"
price.Format = "C"
dgts.GridColumnStyles.Add(price)
dgDetails.TableStyles.Add(dgts)
End Sub
|
|
|
|
|
Ok guys,
This might be a simple question (I hope it has a simple answer). I have a program that gets a handle to an event by using GetEnvironmentVariable. My question is... How do I set this event?
Any sample code would be great!
Thanks,
Waffleman
|
|
|
|
|
WHAT??? Would you like to post some code?
An environment variable doesn't have anything to do with an event handle...
Are you saying that you want to fire an event if your app is asked to return an environment variable?
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Let me clarify, I looked a little more and I am not getting the handle. Instead I am getting the object name. In a similar C++ program the code looks as follows:
if( GetEnvironmentVariable("Notify",szValue,sizeof(szValue)) )
{
hEvent = OpenEvent(EVENT_ALL_ACCESS,FALSE,szValue);
if( NULL == hEvent )
{
printf("AppStarted OpenEvent failed %d <%s>\n",
GetLastError(),szValue);
goto RET;
}
}
if (!SetEvent(hEvent))
{
printf("AppStarted SetEvent failed %d <%s>\n",
GetLastError(),
szValue);
goto RET;
}
}
Here is a link to the details of OpenEvent in MSDN:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/openevent.asp
So how would I open this event and set it in VB.NET?
I hope that makes more sense...
Waffleman
|
|
|
|
|
Yes it does... Your C++ code, which I assume your trying to duplicate in VB.NET, just gets the name of an event signal object. Now, it uses that name to open the event object, provided that it already exists, then it sets the object to signaled. This is used to nofity other threads in an application that an event has happened.
What does you VB.NET code look like? With the OpenEvent function, all you get back IS the event handle, if it exists. The Environment variable is just there to supply the name of the event your getting the handle to. This event object must be created with CreateEvent in some other process before your VB.NET app can Open it...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Here is the only VB.NET code I have:
Dim szNotify as String
szNotify = Environment.GetEnvironmentVariable("Notify")
DebugPrint("Notify: " & Notify, 1)
If (szNotify.Length > 0) Then
'** Set Event
End If
The event signal object is created by the parent program that kicks off the program that I am currently writing in VB.NET. The object name is stored in an environment variable. Right now I am just unclear on how to, when given an event object name, open the event and raise it in VB.NET.
Freiheit ist von Gott, Freiheiten vom Teufel.
|
|
|
|
|
i want to know where does the messanger (yahoo or msn or any)keep the password on the computer and how can i get it from the computer
Lost & Forgotten
|
|
|
|
|
It's stored in a cookie and encrypted. You're not retrieving the password from a cookie without some serious decryption code, that we're not giving you for obvious reasons...
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Yes, the password is stored on your computer. There are a lot of utilities to decrypt them. Try this website[^]
Aaron Eldreth
TheCollective4.com
My Articles
While much is too strange to be believed,
Nothing is too strange to have happened.
- T. Hardy
|
|
|
|
|