|
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
|
|
|
|
|
To add in a program an istruction that, in the moment in which it runs. ..."pause" the program?
...imagine to have a program that it is doing varied things...exists a wayto say..."Stop" (for example) for 10 seconds without makeing nothing and then "restart at the stop point"? (Everything without to have "closed" the program.....but only as likeas it was "in wait?")
Thanks early to all.
Night Soul!!!
|
|
|
|
|
????? It's very difficult to understand you, but I'll take a crack at this...
I take it you want to put your code to sleep for, say 10 seconds. Simple... Use Thread.Sleep(milliseconds As Integer), or Thread.Sleep(TimeSpan):
Imports System
Imports System.Threading
Thread.Sleep(10000) ' Puts the current thread to sleep for 10 seconds.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
thank you again....it works!
Ps: sorry but you how would have expressed my question? (better?)
|
|
|
|
|
"How can I get my code to pause or sleep for as long as I want, and resume at the point it 'fell asleep'?"
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hello
i new to vb.net and i need help with the compling of a project
i press F5 and this should run the project rite?
i got a message saying that im not in the "Debugging Users" group
it just ask me to add myself to this group which i have no idea what is it
can anyone help me?
i cant seen to start my project
thank you in advance
Gary
|
|
|
|
|
Start your Computer Management Console (Start -> All Programs -> Administrative Tools -> Computer Management)
Navigate to Users in the Console ( System Tools -> Local Users and Groups -> Users) and select your user name. Right-click on it, select properties, then select the "member of" tab, and Add the Debugger Users group.
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
|
|
|
|
|
hii nick
thank you for your help
but the problem now is that i cant alter anything at the "member of" tab
it just pop out a message saying "The following error accur while saving....."
"Access is denied"
i have follow your instruction
then at the "member of" tab where is empty
i click add then it say select group
im not sure i did it correctly but this is what i did
i select object type and location (currently only 1 is enable for me to choose)
then i press ok...later the error message pop out
did i do anything wrong?
or maybe cause im using my college computer that i require the IT department to do the setting
im asking this cause i will also need it with my personal pc
thank you
Gary
|
|
|
|
|
You will need to be an administratror to change these settings. If you're using your college pc, you might need to ask the administrator of the machine to add the group for you.
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
|
|
|
|
|
|
Hi,
After I got DateTime from Calendar (ie: fDate = July 04,2004), the date is showed by Debug program is 07/04/2004 but after I using:
strSQL = "SELECT * FROM Invoice WHERE InvoiceDT >= " & fDate>
---> some how it converted fDate back as 04/07/2004 (April 07, 2004) and when execute the SQL I got wrong result!
*) If I get the date later than 12 then there are no problem because MS detects it (ie: 30/06/2004 or 06/30/2004)
1. How can I correct this problem?
2. Do I need special syntax in string SQL for DateTime? (I did try add "#" & fDate "#", the result is the same!)
Many thanks for any help,
Anh
|
|
|
|
|
Your first, and last, mistake is using a concantenated string for an SQL statement.
ALWAYS, ALWAYS, ALWAYS, ... continue for 10 more minutes ..., ALWAYS use PARAMETERIZED queries!
Using a parameterized query will automatically make sure that the date is translated into the appropriate format for the SQL statement. Also, the reverse is true. Any date that is returned will be converted back to the appropriate format for your code.
This is an example from a project I am working on:
Try
oConnection = GetDatabaseConnection()
oCommand = New SqlCommand
oCommand.Connection = oConnection
oCommand.CommandText = "SecurityValidateLogin"
oCommand.CommandType = CommandType.StoredProcedure
Dim sqlParam As New SqlParameter("@Username", SqlDbType.NVarChar, 50)
sqlParam.Value = sUserName
oCommand.Parameters.Add(sqlParam)
sqlParam = New SqlParameter("@Password", SqlDbType.NVarChar, 15)
sqlParam.Value = sPassword
oCommand.Parameters.Add(sqlParam)
sqlParam = New SqlParameter("@SourceIP", SqlDbType.NVarChar, 32)
sqlParam.Value = sSourceIP
oCommand.Parameters.Add(sqlParam)
oConnection.Open()
oCommand.ExecuteNonQuery()
oConnection.Close()
' code removed
Catch ex As Exception
LogErrorEvent("SecurityServices", "ValidateUserLogin", ex.Message, ex.StackTrace)
Throw ex
Finally
' Trash our open objects
If Not oCommand Is Nothing Then
oCommand.Dispose()
End If
If Not oConnection Is Nothing Then
If Not oConnection.State = ConnectionState.Closed Then
oConnection.Close()
End If
oConnection.Dispose()
End If
End Try
Return retValidateValue
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hey Dave,
Under what circumstances should we be using parameterized queries?
Charlie
if(!curlies){ return; }
|
|
|
|
|
all, alL, aLL, ALL OF THEM I SAY! MUAHAHAHHAHAH!!
But seriously, for those who read the posts long after we put them up (yeah, right )...
If you have an SQL stored proecdure or statement with a WHERE clause in it, always use parameterized queries to call it! It will save you a bunch of headaches like the original poster had. It's not hard to do, maybe a little tedious, and it's very easy to follow compared to some of the monsterous string built queries I've seen.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello Dave,
- Thank you for your advice, they are looking very clear ... except that I could not find the right SQLparameter for DateTime format (OLEDBparameters and in your example). We do not want to use them as CString!
- I did find out why I had the problem before, because I set the Region & Language setting in English (Canada) DateTime: Day/Month/Year instead of English USA DateTime: Month/Day/Year ... meanwhile My.mdb set Month/Day/Year! After I change, it works OK now!
*) However, your suggestion (if I can find the way) is more dynamic & appropriate because we do not need to re-set the Region & Language setting
---> If you know how to set SQLparameter more precisely, I will appreciate a lot
Hint: In VC++, we force CASTING DateTime variable to float, then we do not worry about which order the DateTime variable is!
strSQL.Format ("SELECT * FROM Table WHERE Date > %f", (float)fDate;)
Thanks,
|
|
|
|