|
Hi,
Can anyone point me to a direction where I can find some info on how to set/remove user from folder security using vb.net.
Appreciate it..
Thanks...
|
|
|
|
|
In VB6, I'm trying to retrieve the Ascii code of some characters using the "Asc" function. When I try to do it for some spanish characters (special chars) like Ñ I should get a value of 165 but I get 209. What's happening? Am I using a wrong code page? How can I switch in VB6 to the correct one?
Thanks in advance,
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
I didn't think that those sort of characters occured at all in ASCII ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Look at the extended ascii codes that are greater than 128 ...
ASCII table[^]
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
i have a data table containg ledger entries now i want to make a report of leger balances in crystal reports but i am facing problem to calculate opening balace in crystal reports
so if any body now
plz help me
Thanks
Rizwan Ullah
|
|
|
|
|
when u bind a datagrid to a database table the column headings that are displayed are the field name of the table. can we change that? if someone out there can help please do.
|
|
|
|
|
|
Thanks for the reply. But my problem is this:
I have a datagrid. i want to create the connection, bind the data and then change the header at run-time not at design time. If i am creating the connection and binding the data to the grid at design time then i am able to change the header by writing code on the code behind page. but when i am trying to create the connection and also bind the grid at runtime it is not working. can u help me with this?
|
|
|
|
|
What I was referring works perfectly also in your case. Have you followed the example in the official help? If you don't state exactly what you do, or post some code, it's rather complex to come up with an answer.
Other examples are also available on your help under the DataGridColumnStyle class documentation:
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.en/CPref17/html/T_System_Windows_Forms_DataGridColumnStyle.htm
|
|
|
|
|
i am sorry if i offended u in some way.
i was unable to open the link u specified.
c my prob is this:
i have a datagrid and i have created a connection at design time and populated the grid with data using the foll code.
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.SqlDataAdapter1.Fill(DataSet11)
then i wrote the code below to change the headers:
'Step 1: Create a DataGridTableStyle &
' set mappingname to table.
Dim tableStyle As New DataGridTableStyle
tableStyle.MappingName = "BillProductDet"
'Step 2: Create DataGridColumnStyle for each col
' we want to see in the grid and in the
' order that we want to see them.
'Step 2: BillNo
Dim column As New DataGridTextBoxColumn
column.MappingName = "BillNo"
column.HeaderText = "ID"
column.Width = 30
tableStyle.GridColumnStyles.Add(column)
'MfgDate
column = New DataGridTextBoxColumn
column.MappingName = "MfgDate"
column.HeaderText = "M.Date"
tableStyle.GridColumnStyles.Add(column)
'Step 2: UnitPrice
column = New DataGridTextBoxColumn
column.MappingName = "UnitPrice"
column.HeaderText = "Unit Price"
tableStyle.GridColumnStyles.Add(column)
'Step 3: Add the tablestyle to the datagrid
Me.DataGrid1.TableStyles.Add(tableStyle)
End Sub
this is working
but when i am tryting to create the connection at run time using the following code it is not working:
Dim sqlcon2 As New SqlConnection(constr)
Dim sqladp2 As New SqlDataAdapter
Dim cmdstr1 As New SqlCommand
Dim strq1 As String
sqlcon2.Open()
strq1 = "select * from Products"
Try
sqladp2.SelectCommand = cmdstr1
sqladp2.SelectCommand.CommandText = strq1
sqladp2.SelectCommand.Connection = sqlcon2
dsdata2.Clear()
sqladp2.Fill(dsdata2, "SearchResult")
If dsdata2.Tables("SearchResult").Rows.Count > 0 Then
dgrid.DataSource = dsdata2
dgrid.DataMember = "SearchResult"
dgrid.Refresh()
End If
cmdstr1.Dispose()
sqlcon2.Close()
sqlcon2.Dispose()
sqladp2.Dispose()
Catch empexp As SqlException
MessageBox.Show(empexp.Message)
End Try
when i write the code to change the header after this the code is not working.
hope now u understood the problem. and hope u can help me now.
thanks.
|
|
|
|
|
Hi,
I am not sure if this is what you are lookin for.
You can change the sql query like this
Select BillNo as ID,MfgDate as MDate,unitprice as 'Unit Price' from BillProduct.
This will give the header texts as you require.Otherwise there is no text property exposed for a rowheader cell. But you can handle the Paint event and draw header text yourself.
Hopes this meet ur needs
Vimal Raj
|
|
|
|
|
lavanya_satheesh wrote: i am sorry if i offended u in some way.
i was unable to open the link u specified.
You haven't offended me!
The link is rather weird. I guess you have to copy and paste it by yourself in the MSDN Help (don't know how it works that way). If you type it in a browser you'll go nowhere.
Now let's move onto the problem. If you're exposing a datagrid with a dataset as a source you should be able to apply table styles and thus custom columns regardless of the way you populate the dataset. I checked your code and seems ok although I'm missing how you apply the style in the latter case.
When you say "it doesn't work" what do you mean exactly? You get an error? It doesn't compile, or simply you see the datagrid with the unchanged column header?
If your answer is the last one then, probably, the problem should be related to the mapping of the TableStyle or the Column itself. Have you tried to add a n empty test column just to see if it works?
|
|
|
|
|
hi,
thanks for the reply with the smile.
actually when i say it doesnt work i meant the data comes with unchanged headers. i have added many test columns to c whether it works. like vimal420 posted i am able to change the headers using the query also but i am unable to do so using the code i specified. if the mappings are correct when the dataset is populated at design time then it should b correct when i give the same code at runtime also right?
i dont understand what is wrong
|
|
|
|
|
That's sound weird to me (and maybe not 100% clear).
The only thing is that a dataset cannot be populated at design time. It's always populated at run time, normally through a fill. So I wonder if you mean that the difference is that in one case you have a ...(forgot the name)... dataset and in the other not. The word I'm missing here is the common terminology to state that a dataset has (or not) a specific schema associated and therefore columns have specific names. Because if this is the case than there's a difference we can spot.
It's easy to tell with intellisense since in the former case you can type dataset.tablename.columname while in the latter you have to refer them as dataset.table(x).item(y) (if i recall it correctly since I use only the first type).
If this is the case then mapping it's definetly the point since when you populate the dataset you fill in the data but not the schema.
If not than I don't have a prompt answer. What I suggest you is to go through some tries like:
- Comment the code that populate the dataset, leave it empty, and see if something changes
- Add test columns to see if they come up (or you're missing the whole tablestyle)
- Try customizing different column properties....
|
|
|
|
|
hi,
i am sorry if i am still not able to make myself clear to u. in both the cased i am having a dataset. in the first case the connection,adapter and dataset are created at design time and the dataset is populated with fill. in the second case connection, adapter and dataset are created and the run time and the dataset is populated with the code:
sqladp2.Fill(dsdataset2, "SearchResult")
and then the data is displayed in the grid using the code:
If dsdataset2.Tables("SearchResult").Rows.Count > 0 Then
DataGrid1.DataSource = dsdataset2
DataGrid1.DataMember = "SearchResult"
DataGrid1.Refresh()
End If
if u find any prob with this let me know. otherwise it is ok. i actually solved the problem by changing the sql query. i will try ur suggestions and let you know the result.
thanks for taking the time friend, thanks a lot.
|
|
|
|
|
Your code seems correct to me (but when do you apply the tablestle? Before or after that if/endif block?).
I'm sorry not to be more helpful ... but you know remotely is even more difficult....
|
|
|
|
|
How to make a treeview transparent (Windows forms). or how to give a background image to a treeview control.
pls help me,
Vimal
|
|
|
|
|
Neither is supported by the control. You'll have to create your own version of the control, inheriting from TreeView, then supply the drawing code to draw the TreeView with the transparent background or background image. You'll have to Google for "treeview transparent background" for any examples. I don't have any.
Or take the easy route and buy a packaged control that includes the functionality you're looking for.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
How can we send function keys from VB to a remote terminal server. (F1 - F10 to Telnet server). A general info like key code for function key is also expected.
Thanks, Biju V
-- modified at 2:04 Wednesday 30th November, 2005
|
|
|
|
|
When I used follow codes to do an encrypting/decrypting test in DES,one error occured.Can anyone tell me why?
Imports System.Security.Cryptography
Imports System.IO
Imports System.Text
Dim [Unicode] As New UnicodeEncoding, sKey As String = "12345678"
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim DES As New DESCryptoServiceProvider
DES.Key = ASCIIEncoding.ASCII.GetBytes(sKey)
DES.IV = ASCIIEncoding.ASCII.GetBytes(sKey)
Dim arrbytIn As Byte() = [Unicode].GetBytes(TextBox1.Text)
Dim streamOut As New MemoryStream
Dim desEncrypt As ICryptoTransform = DES.CreateEncryptor
Dim csEncrypt As New CryptoStream(streamOut, desEncrypt, CryptoStreamMode.Write)
csEncrypt.Write(arrbytIn, 0, arrbytIn.Length)
streamOut.Seek(0, SeekOrigin.Begin)
TextBox2.Text = New StreamReader(streamOut, [Unicode]).ReadToEnd
csEncrypt.Close()
streamOut.Close()
'Decrypt code
arrbytIn = [Unicode].GetBytes(TextBox2.Text)
streamOut = New MemoryStream
streamOut.Write(arrbytIn, 0, arrbytIn.Length)
streamOut.Seek(0, SeekOrigin.Begin)
Dim desDecrypt As ICryptoTransform = DES.CreateDecryptor
Dim csDecrypt As New CryptoStream(streamOut, desDecrypt, CryptoStreamMode.Read)
'error occured here
TextBox3.Text = New StreamReader(csDecrypt, [Unicode]).ReadToEnd
csDecrypt.Close()
streamOut.Close()
End Sub
|
|
|
|
|
dyh2222 wrote: error occured here
TextBox3.Text = New StreamReader(csDecrypt, [Unicode]).ReadToEnd
Ok the error occurred here - but what was the error?
If you look up the error message and description in the help files or Google same, it can tell you a lot.
I have not analyzed your code but I'd say that there is something wrong with calling ReadToEnd() during the New operation. Good programming practice would be to create an object of type StreamReader then call its ReadToEnd() method.
...Steve
|
|
|
|
|
Steve Pullan wrote: have not analyzed your code but I'd say that there is something wrong with calling ReadToEnd() during the New operation.
Error message is "Wrong data",but I don't know why.Can you help me analyze the code?Thank you!
|
|
|
|
|
Have you looked this error up in the help files or Google? What does it say, what is the recommended solution? Have you split the code into multiple statements as per my last response?
Obviously something is in the wrong format from that expected. Step through the code and ensure that all parameters are of the correct type for the operation at hand and you get the correct results at each line of code.
...Steve
|
|
|
|
|
I have a window service which have to copy a file from local path to Mapped Drive.
Let say the Map folder is E:\data\ . If i try to create a file to this path with a window form application, everything is working fine. But it can't find the Mapped Drive Folder Path, if i using window service application.
Anyone got any idea on this? Thanks in advance!
|
|
|
|
|
The user under which the service is running does not have the same privileges to the network drive that you are trying to map and hence can't see it.
...Steve
|
|
|
|