|
First you shuld get the first checkboxlist's item which is selected.
second use the item's value that you selected in the first checkboxlist as a key to find the second checkobxlist's data and then populate it.
Hope this can help you.
good luck.
|
|
|
|
|
It would probably be more helpful to reply to Member 10043192 who asked the actual question, instead of me who answered it.
|
|
|
|
|
Hi i'm a student currently doing a project in C#.
But i'm having Difficulty in understanding C#.
i need help in drawing shapes.
I need to create my own custom Stencil containing the shapes.
But i'm failed in doing so.e
Is there a way to ADD custom shapes in a stencil ( like FlowChartStencil.xaml) which can be usedand resized at the user wills like in a paint tool...
Thank you
|
|
|
|
|
|
Has your teacher named the phrase "User Control"?
Can you give us the complete assignment?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
|
Sir i created window form application setup And correct working my laptop but problem is when i install another system there are not login error following :-
Collapse | Copy Code
Unhandle Exception has occurred in your application.
A network related or instance- specific error occurred while establishing a connection to sql server. the server was not found or was not accessible. verify that the instance name is correct and that sql server is configured to allow remote connection(provide: SQL network interfaces, error:-26 ERROR locatings server/intance specified)
|
|
|
|
|
Did you modify the connection string to fit the installation of your application and the SQL server being used?
Just because the app ran on your 're machine doesn't mean is going to run everywhere else.
|
|
|
|
|
|
i would like to select foreign key from dropdownlist
|
|
|
|
|
You'll need to obtain a list of these keys then. I assume that you're trying to do this dynamically. Effectively you have two choices:
1. Use a generic ODBC based query to retrieve the list of keys (this isn't the fastest option, but it's largely database agnostic).
2. Write a database specific query to retrieve the list from your system tables.
|
|
|
|
|
Hello guys,
I have a little problem, and I don't know how to make things works.
This is a JSON respone from a website:
{
"data": {
"status": 1,
"status_message": "Comanda a fost introdusa!",
"comanda": {
"id_comanda": "404",
"pret_total": 35,
"modalitate_plata": "Card online"
}
},
"error": false,
"errors": []
}
And I want to parse the values to my console application script.
I build this structure for JavaScriptSerializer:
public class Comanda
{
public string id_comanda { get; set; }
public int pret_total { get; set; }
public string modalitate_plata { get; set; }
}
public class Data
{
public int status { get; set; }
public string status_message { get; set; }
public Comanda comanda { get; set; }
}
public class RootObject
{
public Data data { get; set; }
public bool error { get; set; }
public List<object> errors { get; set; }
}
And I get the value for error response:
RootObject GetProduse_vars = new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize<RootObject>(text);
Console.WriteLine(GetProduse_vars.error);
And "text" variable contains the JSON response.
Can you guys help me to find a solution to get the values from id_comanda and pret_total strings?
Thanks a lot!
Alex Bordei
|
|
|
|
|
I think the JSON deserializer is case-sensitive. Try naming the classes comanda and data.
Also you dind't post the error message you got but the call that produced the error. So we can only guess.
The good thing about pessimism is, that you are always either right or pleasently surprised.
|
|
|
|
|
|
Hello,
I am trying to make a .\Server .\Client C# service that will copy the new data everyday from the .\Server and save it on the .\Client database.
Since I am new at database programming I need some help..
The main problems are that the database from the .\Server will be deleted once every 3 months but it still needs to be saved in the .\Client database.
The functionality of the service should be: everyday at a specific time save the new records (they can be 1-500). Can you give me directions which way to go?
It will be the best if everything can be done just by the service and I don't need to create manually database tables etc. because that will lead to complications with the clients.
Thanks in advance! 
|
|
|
|
|
As I understand at the end of the day you have two SQL databases (names are unimportant). My advise is NOT to write some software to copy data between databases but use SQL Server's build in replication[^] (supported since 2005)...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Yes, I know it will be the best to set up some kind of already build software, BUT.. that will require the customer to do this also and that may lead to complications.. thats why I needed to code it myself and escape customer interaction
if there is any way to set this up via execution of some C# code that will be a variant too..
|
|
|
|
|
You could probably have the application have some way to invoke SQL Server replication.
"I've seen more information on a frickin' sticky note!" - Dave Kreskowiak
|
|
|
|
|
Or look into SSIS to do that simple task.
|
|
|
|
|
I am trying to use Process.Start to launch Excel. If I immediately grab the process returned by the Start method, any addins or extensions to Excel (xlls or xlam) will not work. If I wait until Excel finishes opening and loading all the addins, then grab the process, it works. Need them to work for this project.
I mashed up a class from code I found around to either grab a reference to an existing instance of Excel or to start a new one if it isn't running. Unfortunately, it doesn't work. If the Process.Start method is called, Excel starts loading. The WaitForInputIdle method waits for the message loop to start. But when the message loop starts, Excel is still loading things and has not created any child windows. So the class tries to enumerate the child windows but there are none. And I discovered that once you call EnumChildWindows() it "freezes" things in that it will not refer to a child window created subsequently even if you call it again after the child window is created. So loops to wait are out.
One solution is to recursively create new instances of the class to get around the EnumChildWindows problem, but I end up with 1000's of these instances.
As a kludge, I have a long Thread.Sleep in the code to wait until everything is open. It works correctly but I would like to know if there is a better way to determine if a process has finished opening, especially given the bug/feature in EnumChildWindows.
public class ExcelInteropService
{
private const string EXCEL_CLASS_NAME = "EXCEL7";
private const uint DW_OBJECTID = 0xFFFFFFF0;
private static Guid rrid = new Guid("{00020400-0000-0000-C000-000000000046}");
public delegate bool EnumChildCallback(int hwnd, ref int lParam);
[DllImport("Oleacc.dll")]
public static extern int AccessibleObjectFromWindow(int hwnd, uint dwObjectID, byte[] riid, ref Microsoft.Office.Interop.Excel.Window ptr);
[DllImport("User32.dll")]
public static extern bool EnumChildWindows(int hWndParent, EnumChildCallback lpEnumFunc, ref int lParam);
[DllImport("User32.dll")]
public static extern int GetClassName(int hWnd, StringBuilder lpClassName, int nMaxCount);
public static Microsoft.Office.Interop.Excel.Application GetExcelInterop(int? processId = null)
{
var p = processId.HasValue ? Process.GetProcessById(processId.Value) : Process.Start("excel.exe");
p.WaitForInputIdle();
System.Threading.Thread.Sleep(60000);
Debug.Assert(p != null, "p != null");
try {
return new ExcelInteropService().SearchExcelInterop(p);
}
catch (Exception) {
Debug.Assert(p != null, "p != null");
return GetExcelInterop(p.Id);
}
}
private bool EnumChildFunc(int hwndChild, ref int lParam)
{
var buf = new StringBuilder(128);
GetClassName(hwndChild, buf, 128);
if (buf.ToString() == EXCEL_CLASS_NAME) { lParam = hwndChild; return false; }
return true;
}
private Microsoft.Office.Interop.Excel.Application SearchExcelInterop(Process p)
{
bool timeout = false;
DateTime start = new DateTime();
TimeSpan span = new TimeSpan();
TimeSpan d = new TimeSpan(0, 1, 0);
Microsoft.Office.Interop.Excel.Window ptr = null;
int hwnd = 0;
int hWndParent = 0;
int hr = -1;
Debug.Assert(p != null, "p != null");
try {
start = DateTime.Now;
do {
do {
i++;
hWndParent = (int)p.MainWindowHandle;
if (hWndParent == 0) {
Debug.WriteLine("MainWindowNotFound");
break;
}
EnumChildWindows(hWndParent, EnumChildFunc, ref hwnd);
if (hwnd == 0) {
Debug.WriteLine("ChildWindowNotFound");
break;
}
hr = AccessibleObjectFromWindow(hwnd, DW_OBJECTID, rrid.ToByteArray(), ref ptr);
if (hr < 0) {
Debug.WriteLine("AccessibleObjectNotFound");
break;
}
if (ptr != null)
return ptr.Application;
} while (ptr == null);
span = DateTime.Now - start;
if (span > d)
timeout = true;
} while (timeout == false);
}
catch (Exception ex) {
Debug.Write("Search Exception - ");
Debug.WriteLine(ex.Message);
return null;
}
try {
p.CloseMainWindow();
}
catch (Exception ex) {
Debug.Write("CloseWinMain Exception = ");
Debug.WriteLine(ex.Message);
}
return null;
}
}
Mark Jackson
|
|
|
|
|
mjackson11 wrote: grab a reference to an existing instance of Excel or to start a new one if it isn't running
I haven't done this for a while, but I think you can replace all of that code with:
using System;
using System.Runtime.InteropServices;
using Excel = Microsoft.Office.Interop.Excel;
public static class ExcelInteropService
{
public static Excel.Application FindOrStartExcel()
{
try
{
return (Excel.Application)Marshal.GetActiveObject("Excel.Application");
}
catch (COMException)
{
}
return new Excel.Application();
}
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Unfortunately, the new Excel.Application call is buggy. The Excel instance that is launched will show the addins as being loaded but the addins cannot be used from a vba macro.
|
|
|
|
|
According to this SO question[^], you need to loop through the installed add-ins, set the Installed property to false , and then back to true .
Alternatively, this blog post[^] suggests that you should use the Application.AddIns.Add method to load the add-ins, and explains why they're not loaded when you use new Excel.Application() .
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
OMG, I spent two days on Google looking for this. Thank you thank you thank you. It was driving me nuts.
Mark Jackson
|
|
|
|
|
What do you actually want to achieve? To me, your approach looks line an "XY problem": you do not describe the problem proper, but your idea of a solution which failed somewhere, and now you ask us how to procede on your wrong way. Let's get a few steps back and find the correct way to cope with it.
|
|
|
|