|
If it is possible, i will be making the admin privilege settings at the time of installation after getting the user's permission.Will that have any security breach.
|
|
|
|
|
Again, you can't do it from your code, even in the installation. A user cannot grant permissions above his own account.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
sp_ranjan wrote: I want to set admin privileges only to the exes of my application
Then it must be run as Admin
sp_ranjan wrote: How can this have adverse effect!
Because it could take over the user's machine without the user realising. If you need your application to run as admin you have to ask permission from the user. The user then has to make a judgement whether to trust your code.
|
|
|
|
|
Hi all
in my application i need to desply output in CommandPrompt..
and also i need to take the commands which r desplayed in command prompt..
please can u let me know.
How to desply Output in CommandPrompt....In WINDOWS APPLICATION
Thnk in advance
prashanth,
s/w Engineer,
Syfnosys.
|
|
|
|
|
Please don't cross post, choose the forum that fits best and just ask there.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
i am sorry,, i am poor at english,
here what i wanna say is..
what ever may be the type of application(vb.net/c#.net...)
My requirement is i need to know the process... to desply output in console(cmd prompt) from WINDOWS APPLICATION...
i hope u understood this time..
please help me..
thnx in advance
prashanth,
s/w Engineer,
Syfnosys.
|
|
|
|
|
Look in the documentation on System.Diagnostic.Process Class . You have the ability to write to the StandardOutput through that class
|
|
|
|
|
pashitech wrote: i am poor at english,
Do not cross post, means, please post your question in only one forum.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
following code I used to write text file.
IO.File.Create("C:\test.txt")<br />
IO.File.OpenWrite("C:\test.txt")<br />
For X = 1 To 20<br />
IO.File.AppendAllText("C:\test.txt", "myname")<br />
Next
but it apear foloowing ERROR messege
The process cannot access the file "C:\test.txt" because it is being used by another process.
what I want, that ones open the text file and write details what i want.
how can I handle this
Thiwa
|
|
|
|
|
Do you call Close on the file ? If you don't, then when you try to run it again, the first process may still have the file open. This is because .NET does not have proper destructors, this never happened in C++
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
There is no Close method in IO.File method
Thiwa
|
|
|
|
|
IO.File gives you access to static methods only. You should create a file object, instead of calling static methods, or you should call the WriteAllText method, which I know both opens and closes the file. Fact is, this error means your file is still open.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Dim FileStream As IO.StreamWriter
Dim x as integer
FileStream = New IO.StreamWriter("C:\Test.txt") , True)
for x= 1 to 20
FileStream.WriteLine("myname")
next
FileStream.Flush
FileStream.Close
Give that a try. It uses a stream and keeps it open till you are done writing your data.
|
|
|
|
|
Thank u very vary much........
|
|
|
|
|
I don't think that you have really gotten into the object oriented way of thinking... Let's look at your code.
First you create a file:
IO.File.Create("C:\test.txt")
The Create method returns a FileStream object, but you don't take care of the return value, so you have a open file with no means of writing to it or closing it.
Then you try to open the same file again:
IO.File.OpenWrite("C:\test.txt")
This of course fails, as the file is already open. Even if it did not fail, the OpenWrite method also returns a FileStream object that you just throw away.
Then you try to write to the file:
For X = 1 To 20<br />
IO.File.AppendAllText("C:\test.txt", "myname")<br />
Next
Even if this would work if the file wasn't already open, this is a very inefficient way of writing to a file. Each iteration in the loop would open the file, write a string to it, then close it.
For writing a text file, you should rather use a StreamWriter than a FileStream.
Dim file As StreamWriter<br />
Dim x as Integer<br />
file = IO.File.CreateText("c:\test.txt")<br />
For x = 1 to 20<br />
file.Write("myname")<br />
Next<br />
file.Close()
---
single minded; short sighted; long gone;
|
|
|
|
|
Can anyone give me a SQL statement to create table and field for MS Access?
Thanks
................
|
|
|
|
|
Does normal SQL not work ? I thought with Access you create them visually ? Or do you mean you want code that runs from VB ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Create Table MyTable(MyField1 Text(10), MyField2 Integer, ...)
|
|
|
|
|
|
Good Morning Freinds,
I wnt to generate report on selecting year from the ComboBox/DateTimePicker.
If I Wnt to display only year in combo/datetimepicker, Please tell me wht shuld i do?
My application is in vb.net(Winforms).
priya
|
|
|
|
|
If you want to use the datetimepicker control you need to do something like this:
datetimepicker1.Format =DateTimePickerFormat.Custom
datetimepicker1.CustomFormat ="yyyy"
this will still show the calender. I personally would use a normal combobox and fill it with the proper values
-- modified at 0:18 Tuesday 13th February, 2007
|
|
|
|
|
Thanks for ur help,
I used the same for dateTimepicker.
& this not solves problem.
As u say use combobox, Will you please tell me how should i feel all year values in combobox?
priya
|
|
|
|
|
give this a try
Dim x As Integer
Dim yearStart As Integer = 1900
Dim yearEnd As Integer = 2155
For x = yearStart To yearEnd
ComboBox1.Items.Add(x)
Next
ComboBox1.SelectedIndex = Now.Year - yearStart
|
|
|
|
|
hi!priya....
how r u?
try this code...
Dim I As Integer
Private Sub frmCalender_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For I = 1 To 12
cboMonth.Items.Add(I)
cboMonth.SelectedIndex = 0
Next
'get the years for combo box
Dim Year As Integer
For Year = 1900 To CInt(Val(Format(Now, "yyyy")))
cboYear.Items.Add(Year)
cboYear.SelectedIndex = 0
Next
End Sub
Private Sub cboMonth_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboMonth.SelectedIndexChanged, cboYear.SelectedIndexChanged
cboDate.ValueMember = Str(Date.DaysInMonth((cboYear.SelectedIndex), cboMonth.SelectedIndex + 1))
End Sub
have a good day........
Imagine the I.T
|
|
|
|
|
"cbComLevel" is a combo box(dropdown list) and "ComLevelDetail" is a datatable contains data from database.
i using this method to bind data to combo box.
'---------------------------
With cbComLevel
.DataSource = ComLevelDetail
.DisplayMember = "ComLevel"
.ValueMember = "ID"
End With
Dim ComLevelID As Integer = CInt(cbComLevel.SelectedValue.ToString)
label1.text = ComLevelID
'---------------------------
so this code work fine while i compile the application.
but while i add new code below in order to get the selected value from this combo box while the combo box selected index changed:
'---------------------------
Private Sub cbComLevel_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cbComLevel.SelectedIndexChanged
Dim ComLevelID As Integer = CInt(cbComLevel.SelectedValue.ToString)
label1.text = ComLevelID
End Sub
'---------------------------
the error message come out :
Conversion from string "System.Data.DataRowView" to type 'Integer' is not valid.
I still no idea how to solve it, Who know what happen?
Best regards,
Chee ken
|
|
|
|