|
So what is your actual question?
|
|
|
|
|
how I can disable all the USB mass storage devices except a few based on internal serial number of USB hard disk (as per my white list) in the C# program.That is when ever some connecting any USB devices then PC should able to block it if it is not matching with my white list of hard disk serial numbers.Whit list hard disk serial number I would like to read as configuration file.
|
|
|
|
|
how I can disable all the USB mass storage devices except a few based on internal serial number of USB hard disk (as per my white list) in the C# program.That is when ever some connecting any USB devices then PC should able to block it if it is not matching with my white list of hard disk serial numbers.Whit list hard disk serial number I would like to read as configuration file.
thanks n regards
|
|
|
|
|
|
I've Visual Studio and programming in C# now I want my programm to restart on his own, but i need to restart in Release, because a class changed.
con you may help me?
|
|
|
|
|
Member 11916735 wrote: con you may help me? Help with what? You have not explained where your program is failing. If you just mean that some source code has changed then you need to rebuild and re-install.
|
|
|
|
|
System.Windows.forms.Application.Restart();
|
|
|
|
|
Member 11916735 wrote: because a class changed Do you mean you changed some code? Then you need to compile your program again. But it does not make sense: how should your program know that its source code was changed?
If only some configurable run-time settings changed, just exit your program (e.g. Application.Exit()), but call Process.Start(path_to_your_executable) immediately before that.
|
|
|
|
|
i just want to restart my programm with code. but not in the debug modus, in the release modus
|
|
|
|
|
That requires a recompile.
The app is either compiled in release- or in debug-mode. There is no on-the-fly switching.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Change your current Configuration to Release and then run the code. It will compile a release version.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I know how to start it in debug/release modus with a mouseklick, i just want to do this with a codesnipped
|
|
|
|
|
Try and explain clearly what problem you are trying to solve. Your description leaves a lot of things out.
1. Is the class changing dynamically, so you need to restart it because it has changed at runtime?
2. How is this class being created?
3. Will the machine you are running your application on have Visual Studio installed on it or not?
This space for rent
|
|
|
|
|
Then use Process.Start() and point to either the debug version or the release version.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hello all.
I hoping you could provide some help with a problem I'm having. I have a winform that's developed in Visual Studio 2015 C# that is connected to a Microsoft Access database. This is a fairly small DB. I have no issues with connection or populating my DataGridView with the DB records, but I am having problems with using comboboxes to filter the records based on the users selection. I have 6 comboboxes where the user can select 1 or all 6 comboboxes to filter the table accordingly.
So my problem is that I've tried several things to get this to work but just can't seem to get it working. I think I am not using the correct syntax. Here’s an example of what I’ve tried:
private void cmb_1_SelectedIndexChanged(object sender, EventArgs e)
{
cmd.CommandText = "SELECT * FROM [Document_DB] WHERE [Document Category] '" + cmb_1.Text + "' ";
}
From the code above I’m trying to select all the columns (*) from the database table named Document_DB where I want it to be filtered based on column named Document Category and user selection from cmb_1. Could the space in Document Category be the problem? Should I have name the column heading Document_Category instead? I’d prefer the columns heading not to have underscores in them but if that’s what causing the problem, I’ll just have to do it.
If more info is needed, please let me know. I would greatly appreciate any help you can provide. Thank you!!
modified 10-Apr-16 21:07pm.
|
|
|
|
|
I'd be googling for 'BindingSource' to solve this sort of thing .. typically you would have DataTable connected to BindingSource Connected to DataGridView. You change the BindingSource.Filter BindingSource.Filter Property (System.Windows.Forms)[^] to change what is displayed in the DataGridView .. and the filter language isnt SQL - SQL 'may' be used to populate the underlying datatable initially
I'd checkout things like DataGridView Filter Popup[^], some good ideas there
|
|
|
|
|
Shouldn't there be an equals sign after [Document Category] ?
cmd.CommandText = "SELECT * FROM [Document_DB] WHERE [Document Category] = '" + cmb_1.Text + "' ";
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
|
Hi guys,
I am trying to check for inventory quantity in database. If quatinty entered in dispatch webform is less than inventory, the dispatch should continue. else i should see error message that dispatch quantity is more than inventory and terminate the process.
My code below gives the following results:
When i try dispatching quantity less than inventory, the error still pops up and the program does not continue to excecute dispatch. i do not want this.
I am implementing the code from addbutton that should insert item to gridview (only if quantity is more than inventory).
int SelectedDPItem;
int InventoryQTY;
int DinventoryQTY;
SqlConnection Connection = new SqlConnection("Data Source=localhost;Initial Catalog=warehousedb;Integrated Security=True ");
SqlDataAdapter INVadapter = new SqlDataAdapter("Select ItemID, ItemName, Quantity FROM inventory ", Connection);
SelectedDPItem = int.Parse(DropDownListItem_D.SelectedValue.ToString());
Connection.Open();
SqlCommand Inventorychkcommand = new SqlCommand(("Select Quantity FROM inventory " + ("WHERE (ItemName LIKE \'"
+ (DropDownListItem_D.Text + "\')"))), Connection);
InventoryQTY = Convert.ToInt32(Inventorychkcommand.ExecuteScalar());
DinventoryQTY = Convert.ToInt32(txtQuantity_D.Text);
if (InventoryQTY < DinventoryQTY)
{
{
ClientScript.RegisterStartupScript(this.GetType(), "key", "<script>alert('sorry , Stock Balance is less than requested quantity.')</script>");
}
}
else
{
{
AddNewRecordRowToGrid();
txtwaybill_D.Enabled = false;
DropDownListTransp.Enabled = false;
txtTruckNo_D.Enabled = false;
txtDrivername_D.Enabled = false;
DropDownListEmployee_D.Enabled = false;
btnNew.Enabled = false;
btnPostDispatch.Enabled = true;
DropDownListItem_D.Enabled = false;
txtDispatchDate.Enabled = false;
txtDestn.Enabled = false;
txtQuantity_D.Enabled = false;
txtDestn.Enabled = false;
}
|
|
|
|
|
Don't cross post: You already have this posted in QA, so all you woudl be doing is duplicating work and annoying people. Pick one, and stick with it.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Hi,
Is this the still preferred method? Or has latest .net brought more elegant solution?
this.SetStyle(ControlStyles.DoubleBuffer |
ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint,
true);
|
|
|
|
|
Preferred method for what?
Remember that we can't see your screen, access your HDD, or read your mind...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
|
No need for that attitude. Your question was rather brief and did not explain what you were trying to do/avoid/achieve
|
|
|
|
|
Given the username, I suspect it's our resident troll trying out his new id...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|