w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
save and load Listbox Items locally and pass them to other pages
If you have already stored the data to local storage, you could just read it in the OnNavigatedTo override of the other page. Otherwise, use the navigation parameter: http://social.msdn.microsoft.com/Forums/windowsapps/en-US/8cb42356-82bc-4d77-9bbc-ae186990cfd5/passing-parameters-during-navigation-in-windows-8 Edit: I am not sure whether you also need some information about local storage. This is easy: Windows.Storage.ApplicationData.Current.LocalSettings has a property called Values, which is a Dictionary you can write your settings to. Have a look at http://msdn.microsoft.com/en-us/library/windows/apps/hh700361.aspx Edit: Try something like this code to store your list. // Try to get the old stuff from local storage. object oldData = null; ApplicationDataContainer settings = Applicati

Categories : C#

Access items in listbox in windows phone 7?
Not sure why you're trying to do this by finding the generated element, when you have the source, i.e. something like: protected override void OnNavigatedTo(NavigationEventArgs e) { using (bus_noContext ctx = new bus_noContext(bus_noContext.ConnectionString)) { ctx.CreateIfNotExists(); ctx.LogDebug = true; var buses = from c in ctx.Bus_routes select new bus_list{ BUS_NO = c.BUS_NO, SOURCE = c.SOURCE, DESTINATION = c.DESTINATION}; busno_list.ItemsSource = buses.ToList(); searchbox.Text = buses[20].SOURCE; // or whatever } }

Categories : C#

inserting items of listbox into sql server database
Sure, you could do something like this: using (SqlConnection c = new SqlConnection("your connection string")) { c.Open(); using (SqlCommand cmd = new SqlCommand("INSERT INTO table (field1, field2) VALUES (@field1, @field2)") { foreach (ListItem item in listbox2.Items) { cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@field1", item.Value); cmd.Parameters.AddWithValue("@field2", item.Text); cmd.ExecuteNonQuery(); } } } Now clearly the INSERT statement I provided would be different, and the parameters you add would be different, and maybe you don't need the Value and the Text, but you get the idea.

Categories : C#

Knockout -how to transfer multiselect listbox items(any orde selected items) to another listbox using Knockout?
Just use two observableArrays for available options of both selects. From one .remove(item) and .push(item) to the other. Knockout will track changes. Try an event or click binding. Or put this function in computed observable watching selected items. You didn't made a sample jsfiddle to help you some more with example.

Categories : Knockout Js

ListBox displays "System.Windows.Forms.ListBox.Items.Count..."
To write the items, change the line that does the write to: rollLog.WriteLine(lstBoxOut.items[count]); To read it back in: private void btnReadFile(object sender, EventArgs e) { lstBoxOut.Items.Clear(); foreach (string line in File.ReadLines("Roll Results.txt")) { lstBoxOut.Items.Add(line); } } The reason you're getting that output "System.Windows.Forms.ListBox...." is because the statement rollLog.WriteLine(lstBoxOut) is equivalent to rollLog.WriteLine(lstBoxOut.ToString()). The ToString() method returns A string that states the control type, the count of items in the ListBox control, and the Text property of the first item in the ListBox, if the count is not 0.

Categories : C#

Why I always get the first selected value from a ListBox when I call ListBox.SelectedValue and select items in ASC order inC#?
Try using SelectedItem instead: private void lstEquipos_SelectedIndexChanged(object sender, EventArgs e) { // Get the currently selected item in the list box string currentItem = lstEquipos.SelectedItem.ToString(); // Find the index of the currently selected item in the list box int index = lstEquipos.FindString(cucurrentItemItem); textBox1.Text = index.ToString(); }

Categories : C#

save checked items into database
If I got your question correctly, you want to do the same thing on two different button clicks. You can add onclick events to both buttons and call the same js function. And then submit the related form inside that function.

Categories : Django

C# fill a listbox during the form load event from a Microsoft Access database
Change: View_Membership_Log_Listview.DataSource = dt; View_Membership_Log_Listview.DisplayMember = "Last_Name"; var value = ds.Tables[0].Rows[0]["Last_Name"].ToString(); To: Dictionary<string,string> d_Names = new Dictionary<string,string>(); foreach(DataRow row in ds.Tables[0].Rows) { d_Names.Add(row["Last_Name"].ToString(),row["Last_Name"].ToString()); //Last name is the key, First name could be used as the value or visa versa if needed. } View_Membership_Log_Listview.DataSource = d_Names; View_Membership_Log_Listview.DisplayMember = "Key"; View_Membership_Log_Listview.ValueMember = "Key"; Hope this helps, I dont have VS open infront of me so please forgive any mistakes.

Categories : C#

how to connect MS Access database with matlab (transfer data from GUI and save in database )
You need to run SQL queries on the database; you can do this with database.fetch (and a few other friends). The example query from the docs: conn = database('dbtoolboxdemo','',''); setdbprefs('DataReturnFormat','cellarray') results = fetch(conn, 'select productdescription from producttable') % Not in the example in the docs: this syntax, which I prefer, is also supported results = conn.fetch('select productdescription from producttable'); Note that you will also need to know how to write SQL. For that, there are plenty of resources online - you just have to search for them.

Categories : Database

Removing item from a listbox that is binding to a database table
When in the form(ii) an user is deleting a phone number, just delete it from the db, so next time when the phone numbers are shown in the form(ii) the deleted phone number will not be there. If you do not want to make a post back on delete button click(which will erase the user added phone numbers in the list box as it has not been saved to the db till now), then make an AJAX call to the sever passing the values and delete the number.

Categories : Asp Net

Hide items in a ListBox when ListBox is disabled
Just add another ListBox to the form and when you disable the first listbox with the elements inside of it, hide it, and then display the other to the user which will essentially be an empty greyed out listbox. Then when you enable the box back, hide the empty one and show the real one. Hope this helps.

Categories : C#

Save listBox item to another listBox which is in another class
Bind both view elements (the elements you want to be "connected" with each other) to the same ViewModel collection. So if one writes inside the text box, change propagated to the ViewModel collection, so notification spreads among subscribers, so to another view too.

Categories : C#

Link listBox with Database and show values in textBox if select index in listBox. C#
ideally i would change your listbox to datagridview and change your method like this void fill_listbox() { try { string constring = "datasource=sql2.freesqldatabase.com;port=3306;username=sql217040;password=xxxxx"; string Query = "select * from sql217040.fakedata ;"; using(MySqlConnection conDataBase = new MySqlConnection(constring)) { conDataBase.Open(); using (SqlDataAdapter a = new SqlDataAdapter(Query, conDataBase)) { DataTable t = new DataTable(); a.Fill(t); // Render data onto the screen dataGridView1.DataSource = t; // <-- datagridview1 is the gridview i have added } } } catch(Exception ex)

Categories : C#

Save a query in an access database from C#
Looks like it's not possible. SQL Server doesn't record queries, according to This (Not sure about other databases, but I imagine they all work the same way) You'd need to manually store them as a varchar in a table

Categories : C#

Are there anyway to make ListBox items to word wrap if string width is higher than ListBox width?
Helpful link Check out this answer. It overrides the template of the listbox with a textblock which wraps the text. Hope it's useful. To solve your problem I think you shold add : ScrollViewer.HorizontalScrollBarVisibility="Disabled" . Found it here

Categories : C#

Link Access Database with Mysql Server and Use Access as Frontend [Table Issue]
You just need to rename your Linked MySQL table (rename the link in Access only) so that it matches perfectly the name you were using for that same table before in Access. This way you won't have to change your forms, queries, reports. There is no magic that happens in Access between local tables and linked tables. It's still up to you to move your data, make sure the MySQL table is designed the way you want it, maintain the links, delete old Access tables, etc.

Categories : Mysql

How do I delete items from one table using a join from another in Access?
I believe because ArchiveDelete is a query might be why you are having trouble. Try making a temporary table ArchiveDeleteTemp instead (at least to test) and using that instead. DELETE Transactions.* FROM Transactions INNER JOIN ArchiveDeleteTemp ON Transactions.ConfirmationNumber = ArchiveDeleteTemp.ConfirmationNumber;

Categories : Ms Access

How do I show a few of items (out of many) in my database table?
If you are trying to select the first 10 names for example then you need to change your SQL Select to the following: cmd.CommandText = "SELECT TOP 10 * FROM Transactions WHERE FName=@paramFName"; Is that what you were after? EDIT OK so you are not actually displaying your data anywhere which is the actual problem. You need to create a datatable and display it in a gridview. Check out the following links for examples: Gridview examples MSDN Gridview examples

Categories : C#

How to convert, sort and save to CSV MS Access database .mdb file in Python
Using the generic pyodbc library should do it. Looks like it has already an embedded MS access driver. This question can probably help you out. I dont have any MS Access database files with me (It has been ages that I dont have to work with them), but following the examples your code should be something like this: import pyodbc db_file = r'''/path/to/the/file.res''' user = 'admin' password = 'password' odbc_conn_str = 'DRIVER={Microsoft Access Driver (*.mdb)};DBQ=%s;UID=%s;PWD=%s' % (db_file, user, password) conn = pyodbc.connect(odbc_conn_str) cursor = conn.cursor() cursor.execute("select * from table order by some_column") for row in cursor.fetchall(): print ", ".join((row.column1, row.column2, row.columnN))

Categories : Python

MVC Save user AD Information to Database as soon as site is access the firsttime
I would recommend creating an ActionFilter: public class ADUserActionFilterAttribute : ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext filterContext) { // Do database stuff } } In your /App_Start/FilterConfig.cs add it as a global filter: public class FilterConfig { public static void RegisterGlobalFilters(GlobalFilterCollection filters) { filters.Add(new ADUserActionFilterAttribute()); } } On each request by anyone you can verify the user is in the database (and optionally update the last time they used the website). The question is where do I put that method so that it is only called once the user's accesses the site the first time and not on every page request. This logic does not exist natively in the ASP.Net pipelin

Categories : C#

Xml data Node values need to save into Database table
You can easily extract the information from the <Computer> node and insert it into Asset: (PS: Note: it's a processor - not a "processior" (no i after the two s) ) DECLARE @Input XML SET @Input = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Computer Name="WH7" Processor="Intel(R) Core(TM)2 Duo CPU P9600 @ 2.66GHz" Manufacturer="Dell Inc." Model="Latitude E6500" Domain="WORKGROUP" RAM="3536 MB" ServiceTag="DGQKTJ1"> <BIOS Manufacturer="Dell Inc." Version="Phoenix ROM BIOS PLUS Version 1.10 A19"/> </Computer>' INSERT INTO dbo.Asset(Name, Processor, Manufacturer, Model, Domain, RAM, ServiceTag) SELECT Name = @Input.value('(/Computer/@Name)[1]', 'varchar(50)'), Processor = @Input.value('(/Computer/@Proc

Categories : Xml

Add items from 2 listBox to one listBox
For first part: listbox3.items.add(listbox1.SelectedItem.ToString() + listbox2.SelectedItem.ToString()); For second part: WebRequest request = WebRequest.Create(listBox1.SelectedItem.ToString() + listBox2.SelectedItem.ToString()); Final phase: If exception occurs and different url is expected then do select different url entries from both listbox1 and listbox2 and click the button to check. Also keep correct entries in both the listboxes to avoid exception.

Categories : C#

Can't Save IDs from other tables into current table in database upon creation of an object Rails, Postgresql
I figured out the answer to my problem. Using the rails console, it told me that it was unable to edit certain attributes in the creation of a listing. I'm not sure if it's the rails way to do things, but if I allow the user_id and book_id to be accessible attributes, I am able to store the listing with the correct ids in the database. So my listing model looks as follows: class Listing < ActiveRecord::Base belongs_to :user belongs_to :book has_one :order belongs_to :user, class_name: 'Listing' attr_accessible :listing_id, :price, :user_id, :book_id end I can edit these values in the table appropriately when I create a listing. Thanks to mu is too short for giving me the tip to check the creation of a listing in the rails console. I was not aware that it could be used

Categories : Database

Save Properties.Settings.Default items to list, change the values and then save it to the file
You could access the settings by name, like so. Settings.Default["Item1"]; Since you have the naming convention Item + Incrementing Number in your for loop you could do this, for (int i = 0; i < list.Count; i++) { Settings.Default["Item" + i.ToString()] = listBox1.GetSelected(i); } Properties.Settings.Default.Save();

Categories : C#

WPF Listbox Items
You may want to explore an MVVM approach. In one of your view model classes, you can have an ObservableCollection<string>: public ObservableCollection<string> StuffForListBox { get; set; } Populate that ObservableCollection with what you want to get displayed in the ListBox. In the code-behind of the UserControl or Window in which you have the ListBox, set the DataContext to an instance of the class containing StuffForListBox seen above. this.DataContext = new MyClass(); Alternatively you could also create a datatemplate for the usercontrol / window which will automagically wire up the datacontext with your view model. Since you only mentioned that you want to display the files in a directory (not including sub-directories), you just need to bind the ItemsSource to St

Categories : Wpf

How to add items to the other ListBox in VB?
Your problem is, probably, in trying to access the second form directly. To access it from the first form declare a new second form, 'Dim Sec as New Second'. Now you can access all the controls in the second form, from the first. Then use 'Sec.Show()' to show the form. Also what is the datasource of the listbox in the second form?

Categories : Vb.Net

Trying to insert into access database via SQL getting ID from another table
Extra set of parentheses, and perhaps unqualified field names: String sql = "INSERT INTO tblProblem " + "([MachineID], [ProblemDescription], [ProblemOrder])" + "SELECT tblMachine.[MachineID], @ProblemDescription, @ProblemOrder " + "FROM tblMachine " + "WHERE tblMachine.MachineDescription = @MachineDescription";

Categories : C#

Updating table in one Access database from another?
The following C# console application works for me. Notice that it uses ODBC and it opens "publicdatabase.accdb" with Exclusive=1; to ensure that nobody else is using it. I would hope that it wouldn't be too difficult to apply the same techniques to a VBA solution. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data.Odbc; namespace odbcTest { class Program { static void Main(string[] args) { using (var con = new OdbcConnection( "Driver={Microsoft Access Driver (*.mdb, *.accdb)};" + @"Dbq=C:\__tmppublicdatabase.accdb;" + "Exclusive=1;" + "Uid=admin;" + "Pwd=;")) {

Categories : Vba

Select items from Listbox, one by one
Do what you want to do but i don't understand why you need to select an item form listbox. but you can get the items by listBox1.Items[i] and then can calculate the size. Use below code to do that what you wanted. for (int i = 0; i < listBox1.Items.Count; i++) { listBox1.SelectedItem = listBox1.Items[i]; //Calculate the total size of items present in listbox here }

Categories : C#

Not able to return items in listbox
Since you're adding the options with JS, your server doesn't know this. When you post the values back, they didn't exist at run-time so it grabs the original count (1). You'll have to use another method to get the newly added values, example: add them to a hidden field with runat='server' and grab the values from that.

Categories : Javascript

Add multiple items in a listbox row
See the example from the MSDN ItemsControl.ItemTemplate <ListBox Width="400" Margin="10" ItemsSource="{Binding Source={StaticResource myTodoList}}"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <TextBlock Text="{Binding Path=TaskName}" /> <TextBlock Text="{Binding Path=Description}"/> <TextBlock Text="{Binding Path=Priority}"/> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> It should be pretty straight forward to match with your example.

Categories : C#

More highlighted items in a listbox
To avoid this you'll have to use a wrapper around your strings; your Picture objects seems a good start. Here is a sample that illustrates the two approaches: XAML: <Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525" xmlns:local="clr-namespace:WpfApplication1"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="*" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="*" /> </Gr

Categories : C#

CSV into a table inside a MS Access database using Excel VBA
The easiest way to import CSV into Access is to use DoCmd.TransferText from within an Access application session. But you want to use Excel VBA. In that case, if your MS Office installation includes Access (MSACCESS.EXE), you can use Excel VBA to automate Access and still make use of DoCmd.TransferText for easy CSV import. I tested this module in Excel 2007. It creates the GSPC table and stores the data from table.csv in that table. If the table already exists, TransferText will simply append the CSV data. You can execute DELETE FROM GSPC before running TransferText so the table will contain only the latest CSV data. This may look a bit intimidating considering you said you're a noob. However much of the following is comments I added to guide you. The actual "guts" of that proced

Categories : SQL

How do I delete rows in a table from one database to the other in MS Access
You have the right idea but VBA is quite a bit different from PHP. You can't use variables inside strings with first exiting the string, concatenating the variable, and then starting the string again. Where you would typically use an array called arrDev or arrVSys, we use a DAO Recordset or ADO Recordset object inside MS Access. Updated answer to reflect the information you gave: Dim db As DAO.Database Dim sSQL as String Dim arrDEV As DAO.Recordset, Dim arrVSYS as DAO.Recordset Set db = OpenDatabase("C:SomeDatabase.accdb") sSQL = "SELECT ID, ClusterID FROM DeviceTable WHERE Distribution <> 'Public'" Set arrDEV = db.Open(sSQL) If Not (arrDEV.EOF and arrDEV.BOF) Then arrDEV.movefirst Do Until arrDEV.eof = True sSQL = "SELECT ID FROM VirtualSystemTable WHERE DeviceI

Categories : Ms Access

Database Link to access Columns in Table SQL
Try using merge MERGE INTO TestTable TGT USING ( SELECT t.key, t.ColumnName1, t.ColumnName2, t.ColumnName3, t.ColumnName4, t.ColumnName5 from remotetable@dataBaseLink t ) SRC ON (TGT.KEY = SRC.KEY) WHEN MATCHED THEN UPDATE SET some_column1=src.ColumnName1, some_column2=src.ColumnName2, some_column3=src.ColumnName3, some_column4=src.ColumnName4, some_column5=src.ColumnName5

Categories : SQL

get column names from a table in an Access database using VB.NET
You need to pass the name of the collection you are interested in to the GetSchema method. In the case of the columns collection, you also need to pass in an array of strings to filter the returned values. Dim connectionString = csb2.ToString Dim tableName = "Sales Reports" Dim filterValues = {Nothing, Nothing, tableName, Nothing} Using conn = New OleDbConnection(connectionString) conn.Open Dim columns = conn.GetSchema("Columns", filterValues) For Each row As DataRow In columns.Rows Console.WriteLine("{0,-20}{1}",row("column_name"),row("data_type")) Next End Using See here.

Categories : Vb.Net

Exception while Refresh-ing Items of ListBox
It would be better to maintain your own list separate from the Dictionary and copy values over when the Dictionary changes. I'd advise using an ObservableCollection, so you don't have to do a refresh call. I swear I still have my code for an ObservableDictionary somewhere.

Categories : C#

Items doesn't appear in ListBox in C#, but in XAML yes
I think it's because the ListBox1.Items collection does not implement the INotifyPropertyChanged/INotifyCollectionChanged. You could create an observable collection an assign it to the ItemSource. ObservableCollection<MyData> items = new ObservableCollection() items.Add(new MyData()); ListBox1.ItemSource = items; The reason you don't see it added, is that the listbox is already created/filled and the collection of Items does not notify the listbox when you call the .Add method on the Items property.

Categories : C#

How to export listbox items into XML file
Try the above var xml = new XElement("Items", from s in strings let parts = s.Split('=') select new XElement("Item", new XAttribute("Key", parts[0]), parts[1] ) );

Categories : C#

c# and wpf crisis with blank listbox items
FoodInformation class does not contains properties: Image and Name (you are trying binding to these properties in DataTemplate). From code-behind we can create definition of FoodInformation class with properties Dinner and DinnerImage: class FoodInformation { public string Dinner { get; set; } public ImageSource DinnerImage { get; set; } } So you should binding to properties Dinner and DinnerImage, not to Image and Name. If you change in DataTemplate appropriate properties names everything will be ok. <DataTemplate x:Key="templateListBoxItem"> <Grid Margin="5"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"></ColumnDefinition> <ColumnDefinition Width="*"></ColumnDefinition> </Gri

Categories : C#



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.